refactor loader class