Add comments and refined visualizer.js