added amd/commonjs support