Implemented key pressed and released events