modified for CommonJS