refactor service