csv writing and plot generation works