moved keymap function higher