Added code to save and restore XML