contract token { 
    /* Base token definition. */
    string public name; // Name for the token.
    string public symbol; // Symbol for the token.
    uint8 public decimals; // Number of decimals of the token.
    uint256 public totalSupply; // Total of tokens created.

    // Array containing the balance foreach address.
    mapping (address => uint256) public balanceOf;
    // Array containing foreach address, an array containing each approved address and the amount of tokens it can spend.
    mapping (address => mapping (address => uint256)) public allowance;

    /* This generates a public event on the blockchain that will notify about a transfer done. */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /* Initializes the contract */
    function token(uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol) internal {
        balanceOf[msg.sender] = initialSupply; // Gives the creator all initial tokens.
        totalSupply = initialSupply; // Update total supply.
        name = tokenName; // Set the name for display purposes.
        symbol = tokenSymbol; // Set the symbol for display purposes.
        decimals = decimalUnits; // Amount of decimals for display purposes.
    }

    /* Internal transfer, only can be called by this contract. */
    function _transfer(address _from, address _to, uint _value) internal {
        require(_to != 0x0); // Prevent transfer to 0x0 address.
        require(balanceOf[_from] > _value); // Check if the sender has enough.
        require(balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows.
        balanceOf[_from] -= _value; // Subtract from the sender.
        balanceOf[_to]   += _value; // Add the same to the recipient.
        Transfer(_from, _to, _value); // Notifies the blockchain about the transfer.
    }

    /// @notice Send `_value` tokens to `_to` from your account.
    /// @param _to The address of the recipient.
    /// @param _value The amount to send.
    function transfer(address _to, uint256 _value) public {
        _transfer(msg.sender, _to, _value);
    }

    /// @notice Send `_value` tokens to `_to` in behalf of `_from`.
    /// @param _from The address of the sender.
    /// @param _to The address of the recipient.
    /// @param _value The amount to send.
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        require(_value <= allowance[_from][msg.sender]); // Check allowance.
        allowance[_from][msg.sender] -= _value; // Update the allowance array, substracting the amount sent.
        _transfer(_from, _to, _value); // Makes the transfer.
        return true;
    }

    /// @notice Allows `_spender` to spend a maximum of `_value` tokens in your behalf.
    /// @param _spender The address authorized to spend.
    /// @param _value The max amount they can spend.
    function approve(address _spender, uint256 _value) public returns (bool success) {
        allowance[msg.sender][_spender] = _value; // Adds a new register to allowance, permiting _spender to use _value of your tokens.
        return true;
    }
}
function token(uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol) internal {
    balanceOf[msg.sender] = initialSupply; // Gives the creator all initial tokens.
    totalSupply = initialSupply; // Update total supply.
    name = tokenName; // Set the name for display purposes.
    symbol = tokenSymbol; // Set the symbol for display purposes.
    decimals = decimalUnits; // Amount of decimals for display purposes.
}

/* Initializes the contract */