refactored readXML