imlement input key events handling