Could dead code (`keyReleased`, `keyTyped`) be eliminated here if you don't care about these events?