moved map functionality to service, added tests