function doPurchase(address _sender) private stopInEmergency {
        
        require(tokensSelling != 0);

        
        require(msg.value >= 0.01 * 1 ether);
        
        
        uint tokens = msg.value * 1 ether / tokenPrice;
        
        
        require(token.balanceOf(_sender).add(tokens) <= purchaseLimit);
        
        
        
        tokensSelling = tokensSelling.sub(tokens);
        
        
        tokensSoldTotal = tokensSoldTotal.add(tokens);
        if (token.balanceOf(_sender) == 0) investorCount++;
        weiRaisedTotal = weiRaisedTotal.add(msg.value);
        
        
        token.transfer(_sender, tokens);

        
        beneficiary.transfer(msg.value);

        NewContribution(_sender, tokens, msg.value);
    }