Refactor of mapping controller, most functions pushed out to services