keyboard refactoring