JSLint-led code reorganization

also misc cleanup (delete the console.log), wrap setNodeDisplay slightly
tighter