refactor loader