Setting up event handler for key presses