Added support for AMD and CommonJS