Hello, what do you think of this arduino code in regards to understandability, optimization and size?
Any suggestions for improvements?

void cycleLEDs(int interval) {
  const int nOutPins = sizeof(outPins) / sizeof(outPins[0]);
  static unsigned long lastChange = 0;
  static int currIndex = 0; // Use static to retain value between function calls
  int nextIndex = 0;
  
  if (millis() >= lastChange + abs(interval)) {

    // Determine direction
    int direction = interval < 0 ? -1 : 1;

    // Update secondary index
    nextIndex = currIndex + direction;
    if (nextIndex < 0) {
      nextIndex = nOutPins - 1;
    } else if (nextIndex >= nOutPins) {
      nextIndex = 0;
    }
    
    // Turn off all LEDs
    for (int i = 0; i < nOutPins; i++) {
      if (i == currIndex || i == nextIndex){
        digitalWrite(outPins[i], HIGH);
      } else {
        digitalWrite(outPins[i], LOW);
      }      
    }

    // Update current index
    currIndex += direction;
    if (currIndex < 0) {
      currIndex = nOutPins - 1;
    } else if (currIndex >= nOutPins) {
      currIndex = 0;
    }

    // Update timer
    lastChange = millis();
  }
}

Thank you for your help, i value your input.