update provider documentation. refactor provider code to make everything more clear.