Refactor provider.rb