cleaned the plotting function to only have one call to plot