added functions to visualizer.py