cleanup for rewrite in node.js