Verified that the XDocument will throw an exception when invalid xml is passed into it.  Added comments here and there for clarity.