function buyTokens() public onlyWhitelisted payable {
        require(state == State.Active &&
                block.timestamp <= endAt &&
                msg.value >= lowCapTxWei &&
                msg.value <= hardCapTxWei &&
                collectedWei + msg.value <= hardCapWei);
        uint amountWei = msg.value;

        uint8 bonus = getCurrentBonus();
        uint iwei = amountWei.mul(100 + bonus).div(100);
        uint itokens = iwei * ETH_TOKEN_EXCHANGE_RATIO;
        
        token.icoInvestment(msg.sender, itokens);
        collectedWei = collectedWei.add(amountWei);
        tokensSold = tokensSold.add(itokens);

        if (investments[msg.sender] == 0) {
            
            investorCount++;

        }
        investments[msg.sender] = investments[msg.sender].add(amountWei);

        ICOInvestment(msg.sender, amountWei, itokens, bonus);

        forwardFunds();
        touch();
    }