Cleanup and fix of XML output formatting