toMapKey refactor