function buy (address _address, uint _value, uint _time) internal returns(bool) {

    uint currentStage = getCurrentStage(_time);
    
    require(currentStage != 1000);

    uint tokensToSend = _value.mul((uint)(10).pow(decimals))/stages[currentStage].tokenPrice;

    require (tokensToSend.add(stages[currentStage].tokensSold) <= stages[currentStage].maxCap);

    stages[currentStage].tokensSold = stages[currentStage].tokensSold.add(tokensToSend);

    stages[currentStage].ethContributors[_address] = stages[currentStage].ethContributors[_address].add(_value);

    stages[currentStage].ethCollected = stages[currentStage].ethCollected.add(_value);

    token.sendCrowdsaleTokens(_address, tokensToSend);

    autoDistribute(currentStage);

    return true;
  }