uses case rather than if/else for keypresses