Changed to work as a node.js module.