more complete csv generation. need to be rework