 
 void setupButtons() {
   for (byte i = 0; i < numberOfChannelButtons; i++) {
-    pinMode(channelButtonStart + i, INPUT_PULLUP);
-    channelButtons[i].attach(channelButtonStart + i);
-    channelButtons[i].interval(10);
-    channelButtonStates[i] = false;
-    channelButtonDown[i] = false;
-  }
+    initButton(channelButtonStart + i, &channelButtons[i], &channelButtonStates[i], &channelButtonDown[i]);
+  }
+  initButton(bankDownPin, &bankDownButton, &bankDownState, &bankDownDown);
+  initButton(bankUpPin, &bankUpButton, &bankUpState, &bankUpDown);
+  initButton(stopPin, &stopButton, &stopState, &stopDown);
+  initButton(playPin, &playButton, &playState, &playDown);
+}
+
+void initButton(byte pin, Bounce *button, boolean *state, boolean *down) {
+  pinMode(pin, INPUT_PULLUP);
+  (*button).attach(pin);
+  (*button).interval(10);
+  *state = false;
+  *down = false;
 }
 
 void setupLeds() {

{
  usbMIDI.read();
  updateButtons();
}

void RealTimeSystem(byte realtimebyte) {


void updateButtons() {
  for (byte i = 0; i < numberOfChannelButtons; i++) {
    updateButtonState(channelButtonStart + i, &channelButtons[i], &channelButtonStates[i], &channelButtonDown[i]);
  }
  updateButtonState(bankDownPin, &bankDownButton, &bankDownState, &bankDownDown);
  updateButtonState(bankUpPin, &bankUpButton, &bankUpState, &bankUpDown);
  updateButtonState(stopPin, &stopButton, &stopState, &stopDown);
  updateButtonState(playPin, &playButton, &playState, &playDown);
}

void updateButtonState(byte pin, Bounce *button, boolean *state, boolean *down) {
  if ((*button).update()) {
    if ((*button).read() == LOW) {
      *down = true;
      Serial.print("Button ");
      Serial.print(pin);
      Serial.println(" down");
    } else if (*down) {
      Serial.print("Button ");
      Serial.print(pin);
      Serial.println(" up");
      *state = 1 - *state;
      *down = false;
    }
  }
}
