updated to use global map