Keyboard handling improved