contract MintableToken is ERC20, Contactable {
    using SafeMath for uint;

    mapping (address => uint) balances;
    mapping (address => uint) public holderGroup;
    bool public mintingFinished = false;
    address public minter;

    event MinterChanged(address indexed previousMinter, address indexed newMinter);
    event Mint(address indexed to, uint amount);
    event MintFinished();

    modifier canMint() {
        require(!mintingFinished);
        _;
    }

    modifier onlyMinter() {
        require(msg.sender == minter);
        _;
    }

      /**
     * @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, uint _amount, uint _holderGroup) onlyMinter canMint public returns (bool) {
        totalSupply = totalSupply.add(_amount);
        balances[_to] = balances[_to].add(_amount);
        holderGroup[_to] = _holderGroup;
        Mint(_to, _amount);
        Transfer(address(0), _to, _amount);
        return true;
    }

    /**
     * @dev Function to stop minting new tokens.
     * @return True if the operation was successful.
     */
    function finishMinting() onlyMinter canMint public returns (bool) {
        mintingFinished = true;
        MintFinished();
        return true;
    }

    function changeMinter(address _minter) external onlyOwner {
        require(_minter != 0x0);
        MinterChanged(minter, _minter);
        minter = _minter;
    }
}
function finishMinting() onlyMinter canMint public returns (bool) {
    mintingFinished = true;
    MintFinished();
    return true;
}

/**
 * @dev Function to stop minting new tokens.
 * @return True if the operation was successful.
 */