function buyTokens(address contributor) payable stopInEmergency validPurchase public {
        require(contributor != 0x0);
        require(msg.value >= minimalWei);

        uint256 amount;
        uint256 odd_ethers;
        uint256 ethers;
        
        (amount, odd_ethers) = calcAmount(msg.value, totalWei);  
        require(amount + token.totalSupply() + bonusAvailable <= hardCapInTokens);

        ethers = (msg.value.sub(odd_ethers));

        token.mint(contributor, amount); 
        ETokenPurchase(contributor, ethers, amount);
        totalWei = totalWei.add(ethers);

        if(odd_ethers > 0) {
            require(odd_ethers < msg.value);
            ETransferOddEther(contributor, odd_ethers);
            contributor.transfer(odd_ethers);
        }
        bonusAvailable = bonusAvailable.add(amount.mul(20).div(100));

        wallet.transfer(ethers);
    }