contract StandardToken is Token {

    //Internal transfer, only can be called by this contract
    function _transfer(address _from, address _to,uint256 _value) internal {
        //prevent transfer to 0x0 address.
        require(_to != 0x0);
        //check if sender has enough tokens
        require(balances[_from] >= _value);
        //check for overflows
        require(balances[_to] + _value > balances[_to]);

        uint256 previousBalances = balances[_from]+balances[_to];
        //subtract value from sender
        balances[_from] -= _value;
        //add value to receiver
        balances[_to] += _value;
        Transfer(_from,_to,_value);
        //Assert are used for analysing statically if bugs resides
        assert(balances[_from] + balances[_to] == previousBalances);
    }

    function transfer(address _to, uint256 _value) public returns (bool success) {
        //Default assumes totalSupply can't be over max (2^256 - 1).
        
        _transfer(msg.sender,_to,_value);
    }

    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        
        require(_value <= allowed[_from][msg.sender]);
        allowed[_from][msg.sender] -= _value;
        _transfer(_from,_to,_value);
        return true;
    }

    //Return balance of the owner
    function balanceOf(address _owner) constant returns (uint256 balance) {
        return balances[_owner];
    }

    //Approve the spender ammount
    //set allowance for other address
    // allows _spender to spend no more than _value tokens on your behalf
    function approve(address _spender, uint256 _value) public returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }

    function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
      return allowed[_owner][_spender];
    }

    mapping (address => uint256) balances;
    mapping (address => mapping (address => uint256)) allowed;
    uint256 public totalSupply;
}
function _transfer(address _from, address _to,uint256 _value) internal {
    //prevent transfer to 0x0 address.
    require(_to != 0x0);
    //check if sender has enough tokens
    require(balances[_from] >= _value);
    //check for overflows
    require(balances[_to] + _value > balances[_to]);

    uint256 previousBalances = balances[_from]+balances[_to];
    //subtract value from sender
    balances[_from] -= _value;
    //add value to receiver
    balances[_to] += _value;
    Transfer(_from,_to,_value);
    //Assert are used for analysing statically if bugs resides
    assert(balances[_from] + balances[_to] == previousBalances);
}

//Internal transfer, only can be called by this contract