Better key input handling.