Refactors map controller into a map service