Major JS refactoring: using require.js now