function buy(address buyer) whenNotPaused whenNotFinished public payable {
        require(buyer != address(0));
        require(msg.value.mul(ETHUSD) >= minimalPriceUSD.mul(decim).div(1000));
        
        uint256 tokens = msg.value.mul(ETHUSD).mul(getBonus(buyer)).mul(tokenPricePerUSD).div(100).div(100);
        tokenReward.transfer(buyer, tokens);
        uint256 receivedDollars = msg.value.mul(ETHUSD).div(decim);
        balanceOfUSD[buyer] = balanceOfUSD[buyer].add(receivedDollars);
        balanceOf[buyer] = balanceOf[buyer].add(msg.value);

        tokensRaised = tokensRaised.add(tokens);

        if (tokensRaised >= tokenHardCap) {
            presaleFinished = true;
            uint256 tokenBalance = tokenReward.balanceOf(address(this));
            tokenReward.burn(tokenBalance);
        }
        owner.transfer(msg.value);
    }