Added AMD and CommonJS compatibility