Detect ALL the input events

(not just keyup, but paste, cut, etc)
Moved arrow key stuff to a separate function