Main program now responds correctly to key presses.