added keypress event handling