Working keypad mode, all globals encapsulated