CSV generation restructured.