[Refactoring] Removed some duplicate code in the map. Still some spots to do.