refactoring the map model