Organized files and refactored to use require.js.