Refactor loader in order to make it clearer