Changed how key presses are handled