contract HeartBoutPreICO is CappedCrowdsale, Ownable {
    using SafeMath for uint256;
    
    // The token address
    address public token;
    uint256 public minCount;
    function HeartBoutPreICO(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet, uint256 _cap, uint256 _minCount) public
    CappedCrowdsale(_startTime, _endTime, _rate, _wallet, _cap)
    {
        token = 0x00f5b36df8732fb5a045bd90ab40082ab37897b841;
        minCount = _minCount;
    }
    // fallback function can be used to buy tokens
    function () payable public {}
    // low level token purchase function
    function buyTokens(string _account) public payable {
        require(!stringEqual(_account, ""));
        require(validPurchase());
        require(msg.value >= minCount);
        uint256 weiAmount = msg.value;
        // calculate token amount to be created
        uint256 tokens = weiAmount.mul(rate);
        // Mint only message sender address
        HeartBoutToken token_contract = HeartBoutToken(token);
        token_contract.mint(msg.sender, tokens, _account);
        // update state
        weiRaised = weiRaised.add(weiAmount);
        forwardFunds();
    }
    // mintTokens function
    function mintTokens(address _to, uint256 _amount, string _account) onlyOwner public {
        require(!stringEqual(_account, ""));
        require(validMintPurchase(_amount));
        require(_amount >= minCount);
        uint256 weiAmount = _amount;
        // calculate token amount to be created
        uint256 tokens = weiAmount.mul(rate);
        // Mint only message sender address
        HeartBoutToken token_contract = HeartBoutToken(token);
        token_contract.mint(_to, tokens, _account);
        // update state
        weiRaised = weiRaised.add(weiAmount);
    }
    // send ether to the fund collection wallet
    // override to create custom fund forwarding mechanisms
    function forwardFunds() internal {
        wallet.transfer(msg.value);
    }
    function stringEqual(string _a, string _b) internal pure returns (bool) {
        return keccak256(_a) == keccak256(_b);
    }
    // change wallet
    function changeWallet(address _wallet) onlyOwner public {
        wallet = _wallet;
    }
    // Remove contract
    function removeContract() onlyOwner public {
        selfdestruct(wallet);
    }
}
function () payable public {}

// fallback function can be used to buy tokens