alternative to switch statement for list keypress