refactor the loader