Moved key calculations to switch statement.

Keyboard key press calculations were moved to switch statements to reduce the redundancy in writing "(Routines.getKeyboardKeyCode()".