moved functions to map_utils