   {
     if (retrigger_)
     {
+      // update the currently selected envelope (we use the same envelope for the duration of a curve)
       env_ = selected_env_;
+
+      // reset the gate and release times so that the curve logic can execute
       gate_time_ = 0;
       release_time_ = 0;
+
+      // reset to wait for another retrigger
       retrigger_ = false;
     }
 

        }
        else
        {
          release_time_ = millis();
          cv_released_ = cv_current_;
        }
      }

      cv_out(CO1, cv_current_);
      cv_out(CO3, cv_current_ / 2.0);
    }
    else if (gate_)
    {
      gate_time_ = millis()
          - (unsigned long)(-float(adsr_values_[env_].A) * log(1 - (cv_current_ / (ENV_PEAK * ENV_SATURATION))));
    }

    {
      if (gate_)
      {
        // if the gate is active, we are in the attack, decay, or sustain part of the curve, depending on elapsed time
        uint16_t elapsed = millis() - gate_time_;
        if (elapsed < adsr_values_[env_].A)
        {
