Added a variable to keep track of keyboard-events.