move csv generation into own file