contract StandardToken is ERC223, SafeMath {
        
    uint256 public supplyNum;
    
    uint256 public decimals;

    /* Actual mapBalances of token holders */
    mapping(address => uint) mapBalances;

    /* approve() allowances */
    mapping (address => mapping (address => uint)) mapApproved;

    /* Interface declaration */
    function isToken() public pure returns (bool weAre) {
        return true;
    }


    function totalSupply() constant public returns (uint256 outTotalSupply) {
        return supplyNum;
    }

    
    function transfer(address _to, uint _value, bytes _data) public returns (bool) {
        // Standard function transfer similar to ERC20 transfer with no _data .
        // Added due to backwards compatibility reasons .
        uint codeLength;

        assembly {
            // Retrieve the size of the code on target address, this needs assembly .
            codeLength := extcodesize(_to)
        }

        mapBalances[msg.sender] = safeSub(mapBalances[msg.sender], _value);
        mapBalances[_to] = safeAdd(mapBalances[_to], _value);
        
        if (codeLength > 0) {
            ERC223Receiver receiver = ERC223Receiver(_to);
            receiver.tokenFallback(msg.sender, _value, _data);
        }
        emit Transfer(msg.sender, _to, _value, _data);
        return true;
    }
    
    
    function transfer(address _to, uint _value) public returns (bool) {
        uint codeLength;
        bytes memory empty;

        assembly {
            // Retrieve the size of the code on target address, this needs assembly .
            codeLength := extcodesize(_to)
        }

        mapBalances[msg.sender] = safeSub(mapBalances[msg.sender], _value);
        mapBalances[_to] = safeAdd(mapBalances[_to], _value);
        
        if (codeLength > 0) {
            ERC223Receiver receiver = ERC223Receiver(_to);
            receiver.tokenFallback(msg.sender, _value, empty);
        }
        emit Transfer(msg.sender, _to, _value, empty);
        return true;
    }
    
    

    function transferFrom(address _from, address _to, uint _value) public returns (bool) {
        mapApproved[_from][msg.sender] = safeSub(mapApproved[_from][msg.sender], _value);
        mapBalances[_from] = safeSub(mapBalances[_from], _value);
        mapBalances[_to] = safeAdd(mapBalances[_to], _value);
        
        bytes memory empty;
        emit Transfer(_from, _to, _value, empty);
                
        return true;
    }

    function balanceOf(address _owner) view public returns (uint balance)    {
        return mapBalances[_owner];
    }

    function approve(address _spender, uint _value) public returns (bool success)    {

        // To change the approve amount you first have to reduce the addresses`
        //    allowance to zero by calling `approve(_spender, 0)` if it is not
        //    already 0 to mitigate the race condition described here:
        //    https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
        require (_value != 0); 
        require (mapApproved[msg.sender][_spender] == 0);

        mapApproved[msg.sender][_spender] = _value;
        emit Approval(msg.sender, _spender, _value);
        return true;
    }

    function allowance(address _owner, address _spender) view public returns (uint remaining)    {
        return mapApproved[_owner][_spender];
    }

}
/**
 * Standard ERC223
 */
function isToken() public pure returns (bool weAre) {
        return true;
    }
/* Interface declaration */