refactored map code to location service