function buyTokens(address beneficiary) public payable {
        require(beneficiary != address(0));
        require(validPurchase());

        uint256 _convert_rate = SafeMath.div(SafeMath.mul(rate, getUSDPrice()), 100);

        
        uint256 weiAmount = SafeMath.mul(msg.value, 10**uint256(token.decimals()));
        uint256 tokens = SafeMath.div(weiAmount, _convert_rate);
        require(tokens > 0);
        
        
        

        
        weiRaised = SafeMath.add(weiRaised, msg.value);

        
        emit TokenPurchase(msg.sender, beneficiary, msg.value, tokens);
        
        
    }