contract ERC20Token is ReentryProtected, ERC20Interface
{

  using SafeMath for uint256;

  /* State */
  // The Total supply of tokens
  uint256 totSupply;

 
  // Token ownership mapping
  mapping (address => uint256) balance;

  // Allowances mapping
  mapping (address => mapping (address => uint256)) allowed;

  /* Funtions Public */

  function ERC20Token()
  {
    // Supply limited to 2^128 rather than 2^256 to prevent potential 
    // multiplication overflow
    
    totSupply = 0;
      balance[msg.sender] = totSupply;
  }

  // Using an explicit getter allows for function overloading    
  function totalSupply()
  public
  constant
  returns (uint256)
  {
    return totSupply;
  }


  // Using an explicit getter allows for function overloading    
  function balanceOf(address _addr)
  public
  constant
  returns (uint256)
  {
    return balance[_addr];
  }

  // Using an explicit getter allows for function overloading    
  function allowance(address _owner, address _spender)
  public
  constant
  returns (uint256 remaining_)
  {
    return allowed[_owner][_spender];
  }


  // Send _value amount of tokens to address _to
  // Reentry protection prevents attacks upon the state
  function transfer(address _to, uint256 _value)
  public
  noReentry
  returns (bool)
  {
    return xfer(msg.sender, _to, _value);
  }

  // Send _value amount of tokens from address _from to address _to
  // Reentry protection prevents attacks upon the state
  function transferFrom(address _from, address _to, uint256 _value)
  public
  noReentry
  returns (bool)
  {
    require(_value <= allowed[_from][msg.sender]);
    allowed[_from][msg.sender] -= _value;
    return xfer(_from, _to, _value);
  }

  // Process a transfer internally.
  function xfer(address _from, address _to, uint256 _value)
  internal
  returns (bool)
  {
    require(_value > 0 && _value <= balance[_from]);
    balance[_from] -= _value;
    balance[_to] += _value;
    Transfer(_from, _to, _value);
    return true;
  }

  // Approves a third-party spender
  // Reentry protection prevents attacks upon the state
  function approve(address _spender, uint256 _value)
  public
  noReentry
  returns (bool)
  {
    require(balance[msg.sender] != 0);
    allowed[msg.sender][_spender] = _value;
    Approval(msg.sender, _spender, _value);
    return true;
  }
}
function transfer(address _to, uint256 _value)
public
noReentry
returns (bool)
{
  return xfer(msg.sender, _to, _value);
}

// Send _value amount of tokens to address _to
// Reentry protection prevents attacks upon the state