Refactored Xml parsing