added hotkeys and improved clarity of onkeydown function