added tests/functionality for handling key events