contract CappedToken is MintableToken {

  uint256 public cap;

  function CappedToken(uint256 _cap) public {
    require(_cap > 0);
    cap = _cap;
  }

  /**
   * @dev Function to mint tokens
   * @param _to The address that will receive the minted tokens.
   * @param _amount The amount of tokens to mint.
   * @return A boolean that indicates if the operation was successful.
   */
  function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
    require(totalSupply().add(_amount) <= cap);

    return super.mint(_to, _amount);
  }

  function transferFromAdmin(address _to, uint256 _value) onlyOwner public returns (bool) {
    require(_to != address(0));
    require(_value <= balances[msg.sender]);
    balances[msg.sender] = balances[msg.sender].sub(_value);
    balances[_to] = balances[_to].add(_value);
    specialAccount[_to] = true;
    emit Transfer(msg.sender, _to, _value);
    return true;
  }

}
/**
 * @title Capped token
 * @dev Mintable token with a token cap.
 */
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
  require(totalSupply().add(_amount) <= cap);

  return super.mint(_to, _amount);
}

/**
 * @dev Function to mint tokens
 * @param _to The address that will receive the minted tokens.
 * @param _amount The amount of tokens to mint.
 * @return A boolean that indicates if the operation was successful.
 */