small refactor to allow drawxml to be called from another script
write output to separate directory (to avoid file clutter); write metric to output file one at a time (rather than collecting all the results in an array) so to make more resiliant to external program crashes
Merge remote-tracking branch 'origin'