Eliminate duplication by handling this in AbstractVisualization. Undo all my previous main.js changes.