convert to require.js