Update to run on the server under node.js as well as the browser