refactored provider creation