Refactoring to service provider