Aligned format to suit Shaun's way and small debug

debugged a small error when player clicks the delete button first before
entering the keycode, resulting in reading the wrong keycode value.