contract CORUtilityToken is StandardToken, Ownable {
    
    using SafeMath for uint256;
    
    // Descriptive properties
    string public constant name = "CORUtilityToken";
    string public constant symbol = "COR";
    uint256 public constant decimals = 18;
    string public version = "7.0";
    bool public hasBeenConstructed = false;

    // Account for ether proceed.
    address public etherProceedsAccount = 0x772dE72388b021fD44bA9662281D93b75A4C31c2 ;

    // Reserve account for 83% of COR creation cap.
    address public CORReserveAccount = 0xfAFcC6352c3fA7905888e981C939f154fD921307 ;
    uint256 public constant CORReserveAllocation = 8.3 * (10**6) * 10**decimals;

    // These params specify the start, end, min, and max of the sale.
    uint256 public fundingStartBlock = 4826150;
    uint256 public fundingEndBlock = 5087090;
    uint256 public constant tokenCreationCap =  10 * (10**6) * 10**decimals;
    
    // Setting the exchange rate for the COR alpha utility token sale.
    uint256 public constant COREthExchangeRate = 100;

    // Event for token creation.
    event CreateCOR(address indexed _to, uint256 _value);

    // constructor
    function COR() public
    {
      if (hasBeenConstructed) revert();
      totalSupply                 = CORReserveAllocation;
      balances[CORReserveAccount] = CORReserveAllocation;
      CreateCOR(CORReserveAccount, CORReserveAllocation);
      hasBeenConstructed = true;
    }

    function createTokens() payable external {
      if (block.number < fundingStartBlock) revert();
      if (block.number > fundingEndBlock) revert();
      if (msg.value == 0) revert();

      uint256 tokens = COREthExchangeRate.mul(msg.value);
      uint256 checkedSupply = totalSupply.add(tokens);

      if (tokenCreationCap < checkedSupply) revert();

      totalSupply = checkedSupply;
      balances[msg.sender] += tokens;
      CreateCOR(msg.sender, tokens);
      etherProceedsAccount.transfer(this.balance);
    }

}
/////////////////
function COR() public
{
  if (hasBeenConstructed) revert();
  totalSupply                 = CORReserveAllocation;
  balances[CORReserveAccount] = CORReserveAllocation;
  CreateCOR(CORReserveAccount, CORReserveAllocation);
  hasBeenConstructed = true;
}

// constructor