refactoring keyboard