refractored requirejs loader