AMD: CommonJS and RequireJS support

I've added support for AMD (requirejs and commonjs). Could you merge it?