Add sorting to keypad problem.