refactoring provider, added comments