refactor visualizer