Cleaned code up, introduced non-blocking user input so that we can send a
special key when the user is not using the keyboard