Improve keyboard handling.