function buy (address _address, uint _value) internal returns(bool) {
    uint currentStage = getCurrentStage();
    if (currentStage == 100){
      return false;
    }

    uint _phasePrice = icoStages[currentStage].tokensPrice;
    uint _tokenPrice = _phasePrice.add(_phasePrice.mul(icoStages[currentStage].discount)/10000);
    uint tokensToSend = _value.mul(_tokenPrice)/(uint(10).pow(uint(12))); 

    if(ethCollected >= ICO_MIN_CAP){
      distributionAddress.transfer(address(this).balance);
    }

    token.sendCrowdsaleTokens(_address,tokensToSend);
    
    tokensSold = tokensSold.add(tokensToSend);
    ethCollected += _value;
    
    return true;
  }