refactoring to a ServiceProvider model