Refactor data visualizer