Changed writing XML to writing CSV