Better placement of keyup listner/keydown removal. Removed other changes accordingly