added amd and commonjs support