Restructured JavaScript source code to add require.js compilation to grunt