Refactor to remove the awful string dot equals way of building XML. Now using XMLWriter.