handling keyboard events.