refactor provider