Refactoring template service.