Refactor app/models/loader.rb