Keypad .kstate question

OK I have done more playing in the meantime and right now I have the following CODE for separating out 3 buttons from the normal loop and then letting the remaining go into an another switch to allow for decoding for the encoders.

void CheckEncoders9(void){
   // Check for Single Button usage or Run Encoder Coding
  if (PSE9matrix.getKeys()) {
    for (int i=0; i<LIST_MAX; i++) {    // Scan the whole key list.
      if (PSE9matrix.key[i].stateChanged ) {    // Only find keys that have changed state.
        if (PSE9matrix.key[i].kchar == 8 ||PSE9matrix.key[i].kchar == 21 || PSE9matrix.key[i].kchar == 22) {  
          switch (PSE9matrix.key[i].kstate) {    // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
          case PRESSED:
            msg = " pressed";
            Joystick.button(PSE9matrix.key[i].kchar, 1);
          break;
          case HOLD:
            msg = " held";
          break;
          case RELEASED:
            msg = " released";
            Joystick.button(PSE9matrix.key[i].kchar, 0);
          break;
          case IDLE:
            msg = " idle";
          break;
          }
        byte s = PSE9matrix.key[i].kchar;
        Serial.print("Button ");
        Serial.print(s);
        Serial.print(" is");
        Serial.println(msg);
        } else {
          switch (PSE9matrix.key[i].kstate) {    // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
          case PRESSED:
            msg = " pressed";
            Joystick.button(PSE9matrix.key[i].kchar, 1);
          break;
          case HOLD:
            msg = " held";
          break;
          case RELEASED:
            msg = " released";
            Joystick.button(PSE9matrix.key[i].kchar, 0);
          break;
          case IDLE:
            msg = " idle";
          break;
          }
        byte s = PSE9matrix.key[i].kchar;
        Serial.print("Encoder Button ");
        Serial.print(s);
        Serial.print(" is");
        Serial.println(msg);  
        }
      }   
    }
  }  
}

By this code I get the following presses on an encoder on inputs for button 27 and 28

Clockwise Turn

Encoder Button 28 is pressed
Encoder Button 27 is pressed
Encoder Button 28 is released
Encoder Button 28 is idle
Encoder Button 27 is released
Encoder Button 27 is idle

Counter-Clockwise Turn

Encoder Button 27 is pressed
Encoder Button 28 is pressed
Encoder Button 27 is released
Encoder Button 27 is idle
Encoder Button 28 is released
Encoder Button 28 is idle

Which of course is the exact opposite sequence..

So now I have to pair up the buttons into ODD and EVEN sets so they are dedicated to an encoder and then be able to read which ordering is triggered through the state to determine whether the encoder is turning Clockwise or Counter-Clockwise.. I need to somehow pair them up because the active keylist does not always have buttons next to each other such as if two encoders were turned at the same time I could end up with an active key list of [ 14, 28, 15, 27] even though the ones that have to be paired to read the sequence correctly would be 14 / 15 and 27 / 28, so I can't just read the next Active list rotation as is or I might be reading wrong patterns.

So I will have to think about this a bit.. Right now I am thinking I am going to have to separate out the odd and even kchar into separate state loops like I did for the single button and then do a variable for that can be passed out of the loop to be able to pair up the correct odd/odd and even buttons and then make sure that their activation follows one of the two sequences above to verify the Button to actually be pressed through the HID interface for the game controller to indicate Clockwise or Counter-Clockwise..

Earlier I determined the ODD and Even off to the First of the pair to trigger ie if 27 was trigged because it was an odd number I would +1 to get 28 and if 28 (even determination) I would -1 to get 27 which easily paired the numbers and I think I can still use this method and possibly the findInList to pair up the state on each loop and if I can read the state over four loops I can determine the sequence.. But then just running through my head if a second encoder started turning mid sequence I could run into issues unless i separate the sequences which I guess I can do if I can build a state array for the Active encoder list and then compare that array with the Known Sequence and then trigger the HID Button wanted if the Arrays match...

OK now I am just thinking aloud so I will stop.. But I think there are several ways that I can accomplish this.. just trying to figure out the best and most efficient.

I think I can do it.. If you have any suggestions for doing this please feel free to suggest...