Debug, XML

Debug logging to XML file now working. Consider refactor of
EndOfExecution method for cleaner code.