Made to work with AMD and CommonJS standards
Added support for AMD and CommonJS