refactoring the service_name change and fixing tests