Updated saving method to xml.