refactoring to use require.js AMD modules instead of browser global modules