added event handling for the arrow keys