Adjustments on CSV generation and cleanup