function()public payable {
        
        require(hasStarted == true);
        
        require((block.timestamp >= preSale.start && block.timestamp <= preSale.end)
            || (block.timestamp >= sale.start && block.timestamp <= sale.end)
        ); 

        
        require(msg.value >= 100 finney);
        
        uint timeOfRequest;
        uint tokenAmount;
        uint weiRemainder;
        uint bonus;
        
        (timeOfRequest, tokenAmount, weiRemainder, bonus) = getTokensForContribution(msg.value);

        
        require(tokensRemainingForSale >= tokenAmount + bonus);
        
        
        require(tokenAmount > 0);
        
        
        require(weiRemainder <= msg.value);

        
        if (timeOfRequest <= preSale.end) {
            require(tokenAmount <= preSale.tokens);
            require(bonus <= sale.tokens);
            preSale.tokens -= tokenAmount;
            sale.tokens -= bonus;
        } else {
            require(tokenAmount <= sale.tokens);
            
            require(bonus == 0); 
            sale.tokens -= tokenAmount;
        }

        
        addContribution(msg.sender, msg.value - weiRemainder, tokenAmount + bonus);

        
        owner.transfer(msg.value - weiRemainder);
        
        msg.sender.transfer(weiRemainder);

        
        
        
        
        Contribute(msg.sender, msg.value - weiRemainder, tokenAmount + bonus);
    }