Improve keydown if statement