Restructuring use of KeyMap