contract StandardToken is Token {

/*
---------------------------------------------------------------------------------------------
    Storage data structures
---------------------------------------------------------------------------------------------
*/
    mapping (address => uint256) balances;
    mapping (address => mapping (address => uint256)) allowed;

/*
---------------------------------------------------------------------------------------------
    Public facing functions
---------------------------------------------------------------------------------------------
*/

    /// @notice Send "_value" tokens to "_to" from "msg.sender".
    /// @dev Transfers sender's tokens to a given address. Returns success.
    /// @param _to Address of token receiver.
    /// @param _value Number of tokens to transfer.
    /// @return Returns success of function call.
    function transfer(address _to, uint256 _value) public returns (bool) {
        require(_to != 0x0);
        require(_to != address(this));
        require(balances[msg.sender] >= _value);
        require(balances[_to] + _value >= balances[_to]);

        balances[msg.sender] -= _value;
        balances[_to] += _value;

        Transfer(msg.sender, _to, _value);

        return true;
    }

    /// @notice Transfer "_value" tokens from "_from" to "_to" if "msg.sender" is allowed.
    /// @dev Allows for an approved third party to transfer tokens from one
    /// address to another. Returns success.
    /// @param _from Address from where tokens are withdrawn.
    /// @param _to Address to where tokens are sent.
    /// @param _value Number of tokens to transfer.
    /// @return Returns success of function call.
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool)
    {
        //Address shouldn't be null
        require(_from != 0x0);
        require(_to != 0x0);
        require(_to != address(this));
        require(balances[_from] >= _value);
        require(allowed[_from][msg.sender] >= _value);
        require(balances[_to] + _value >= balances[_to]);

        balances[_to] += _value;
        balances[_from] -= _value;
        allowed[_from][msg.sender] -= _value;

        Transfer(_from, _to, _value);

        return true;
    }

    /// @notice Approves "_who" to transfer "_value" tokens from "msg.sender" to any address.
    /// @dev Sets approved amount of tokens for the spender. Returns success.
    /// @param _who Address of allowed account.
    /// @param _value Number of approved tokens.
    /// @return Returns success of function call.
    function approve(address _who, uint256 _value) public returns (bool) {

        // Address shouldn't be null
        require(_who != 0x0);

        // To change the approve amount you first have to reduce the addresses`
        // allowance to zero by calling `approve(_who, 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 || allowed[msg.sender][_who] == 0);

        allowed[msg.sender][_who] = _value;
        Approval(msg.sender, _who, _value);
        return true;
    }

    /// @dev Returns number of allowed tokens that a spender can transfer on behalf of a token owner.
    /// @param _owner Address of token owner.
    /// @param _who Address of token spender.
    /// @return Returns remaining allowance for spender.
    function allowance(address _owner, address _who) constant public returns (uint256)
    {
        return allowed[_owner][_who];
    }

    /// @dev Returns number of tokens owned by a given address.
    /// @param _owner Address of token owner.
    /// @return Returns balance of owner.
    function balanceOf(address _owner) constant public returns (uint256) {
        return balances[_owner];
    }
}
/// @title Standard token contract - Standard token implementation.
function approve(address _who, uint256 _value) public returns (bool) {

    // Address shouldn't be null
    require(_who != 0x0);

    // To change the approve amount you first have to reduce the addresses`
    // allowance to zero by calling `approve(_who, 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 || allowed[msg.sender][_who] == 0);

    allowed[msg.sender][_who] = _value;
    Approval(msg.sender, _who, _value);
    return true;
}

/// @notice Approves "_who" to transfer "_value" tokens from "msg.sender" to any address.
/// @dev Sets approved amount of tokens for the spender. Returns success.
/// @param _who Address of allowed account.
/// @param _value Number of approved tokens.
/// @return Returns success of function call.