Refactoring Provider class initialize connection