Shortened the keypress code slightly