added a little functionality of writing XML file for clustering