refactored into modules using require.js