Adding AMD/CommonJS support

Needed to add AMD support for a project I'm working on.