now adding the plotting and saving capabilities