Some csv writing and such