Better csv generation approach