Refactor keyboard handling (#16).