Clean up toXml
Merge pull request #196 from GrahamCampbell/fixes

Clean up toXml