Refactoring with Require.js