refatcored map functions into one similar to main loc functions