keyboard input, expansion, refactoring