improved KeyHandler module