adding some comments and fixing a bug caused by the user pressing keys other than arrow keys