Added support for require.js, and migrated some code over to using it. You'll like this.

This code basically just ports main.js to use require.js.  You may find it's syntax and flexibility pleasant and useful.  Take this if you like it.