Refactoring for ServiceProvider.