refactored application using require.js