Consolidated processing of XML file into one method, rather than duplicating.
Fixed error processing.