refactoring service code, particularly removing spaces and simplifying containers