Refactored a bit.  Added event handling for key presses.