Added save to csv, small helper methods