Write your keypad code so that it returns 'scan codes' i.e. the number of the key that is pressed, 0-15 is a good choice.
Process the keys by using the scan code as an index into an array of key codes that associates the scan code with the key's value. As keys are pressed, convert their scan codes to key values by looking them up in the array.
To extend the keypad:
Dedicate one key as a SHIFT or ALTERNATE FUNCTION key. When it is pressed, set a flag that indicates the shift/alternate function is active.
When the flag is set, use a different array to look up the alternate key values.
Clear the shift flag after each entry or make it a toggle i.e. push once for alternate values, push again for normal values.
There are many variations on this scheme but it's about as simple as it gets. You can also make it so you hold the SHIFT button while pressing another key but that requires some logic changes to the lower level keyboard scanner. The shift/alternate function as I describe it uses standard scanning. I've used both methods over the years.