rework csv code (no functional change)