Implement services and refactoring