add handler for keyboard input