Refactor XmlManager