add write to csv; need discussion of what to write and when to write