Turned custom code into a ServiceProvider.