Refactoring for provider instead of factory
Refactoring and add documentation