Added flattening csv code.