Fixing up some stuff so code will run in the browser or Node.js environments