Added comments, properly handle input case where keycode isnt at all valid.