refactored keyboard handling to a new class (which may deal with multiple views)