Completed refactoring in Loader.js.