refactored the javascript file loading