new method keyPressHandler