Cleanup of PlotMain