Improves code organization in resourceloader.js