Adapted to require.js