uses csv writer