Refactored xml generation to use new xmlHelper functions