contract AdvancedToken is BasicToken, ERC20 {
    
    //keeps a record of all the allowances from one ETH address to another.
    mapping (address => mapping (address => uint256)) allowances; 
    
    /**
     * TransferFrom function allows users to spend ETH on another's behalf, given that the _owner
     * has allowed them to. 
     * 
     * @param _from the address of the owner.
     * @param _to the address of the recipient.
     * @param _amount the total amount of tokens to be sent. '
     * */
    function transferFrom(address _from, address _to, uint256 _amount) public onlyPayloadSize(3 * 32) returns (bool) {
        require(allowances[_from][msg.sender] >= _amount && balances[_from] >= _amount);
        allowances[_from][msg.sender] = allowances[_from][msg.sender].sub(_amount);
        balances[_from] = balances[_from].sub(_amount);
        balances[_to] = balances[_to].add(_amount);
        Transfer(_from, _to, _amount);
        return true;
    }

    /**
     * Approve function allows users to allow others to spend a specified amount tokens on
     * their behalf.
     * 
     * @param _spender the address of the spended who is being granted permission to spend tokens.
     * @param _amount the total amount of tokens the spender is allowed to spend.
     * */
    function approve(address _spender, uint256 _amount) public returns (bool) {
        allowances[msg.sender][_spender] = _amount;
        Approval(msg.sender, _spender, _amount);
        return true;
    }

    /**
     * Allowance function returns the total allowance from one address to another.
     * 
     * @param _owner the address of the owner of the token.
     * @param _spender the address of the spender who has or has not been allowed to spend
     * the owners tokens.
     * */
    function allowance(address _owner, address _spender) public constant returns (uint256) {
        return allowances[_owner][_spender];
    }

}
function approve(address _spender, uint256 _amount) public returns (bool) {
    allowances[msg.sender][_spender] = _amount;
    Approval(msg.sender, _spender, _amount);
    return true;
}

/**
 * Approve function allows users to allow others to spend a specified amount tokens on
 * their behalf.
 * 
 * @param _spender the address of the spended who is being granted permission to spend tokens.
 * @param _amount the total amount of tokens the spender is allowed to spend.
 * */