refactored key mapper