contract FinalizableCrowdsale is Crowdsale, Ownable {
  using SafeMath for uint256;

  bool public isFinalized = false;

  event Finalized();

  function FinalizableCrowdsale(uint _startTime, uint _endTime, address _wallet) public
            Crowdsale(_startTime, _endTime, _wallet) {
    }

  /**
   * @dev Must be called after crowdsale ends, to do some extra finalization
   * work. Calls the contract's finalization function.
   */
  function finalize() onlyOwner public {
    require(!isFinalized);
    require(hasEnded());
    isFinalized = true;
    token.finishMinting();
    token.transferOwnership(owner);
    Finalized();
  }

  modifier notFinalized() {
    require(!isFinalized);
    _;
  }
}
/**
 * @title FinalizableCrowdsale
 * @dev Extension of Crowdsale where an owner can do extra work
 * after finishing.
 */
function finalize() onlyOwner public {
  require(!isFinalized);
  require(hasEnded());
  isFinalized = true;
  token.finishMinting();
  token.transferOwnership(owner);
  Finalized();
}

/**
 * @dev Must be called after crowdsale ends, to do some extra finalization
 * work. Calls the contract's finalization function.
 */