update to use csv writer