A quick and ugly port to CommonJS.