fixed some bugs and added writing to filename, visualizing
made new visualize to take input from generator