modularized keypress functions (will eventually migrate most ui functions over)