updated CSV generation script