Code refactoring in service.