reorganizing as node.js module