refactors loader