refactor keyboard input into MappedInput to make testable