added flatten and list to csv