refactored the provider