Most of this map-related stuff is duplicated from `_map_common` ... can we share instead?