refactored provider