Fixed implementation using require.js