Add AMD support

Besides adding AMD support, also minified the source code using [Google Closure Compiler](http://closure-compiler.appspot.com/home).