refactored onKeyUp, added onKeyPress