add AMD and CommonJS support