decrease memory usage in generate_csvs via getting rid of enormous hashes within loops