       digitalWrite(rankPins[manual], LOW);
 
       // poll all keys, sending MIDI events if warranted
-      rankPoll(keyPins, keyStates[manual], numKeys, manual);
+      keyPoll(keyPins, keyStates[manual], numKeys, manual);
 
       // return the drive pin to +5V (off)
       digitalWrite(rankPins[manual], HIGH);



// function to handle the loop over a given rank, updating states
void rankPoll(const int keyPins[], bool (&states)[], int arraySize, int rank) {
  for(int key=0; key<arraySize; key++){
      // run through all switches, reading their values
      // pass results to keyChange which will dispatch a MIDI event if needed
      keyChange(digitalRead(keyPins[key]), states[key], key, midiChannels[rank]);
  }
}


// constants won't change. They're used here to
// set pin numbers for first 2 octaves
const int keyPins[] = {28, 26, 24, 22, 13, 12, 11, 10, 9, 8, 7, 6, 14, 15, 16, 17, 18, 19, 20, 21, 27, 25, 23, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 52, 50, 48, 46, 44, 42, 40, 38, 36, 34, 32, 30,};
const int rankPins[] = {5, 4, }; // drive wire(s) for ranks are: {5, 4, 3, 2, 67, and 69 (pedals)}
const int pedalPin = 69;
/*
  Note for reference, the analog -> digital pin mappings for the Mega are:
  A0 = 54
