re-working how main.js is loaded