Improves KeyEvent handling