refactoring xml_tools