Moves map code into the searchCtrl controller.