restructure using require.js