node.js code cleanup