Adding event handlers for keyboard events