result_data wasn't being defaulted to None, so an error was being thrown during the XML function. result_data is now set beforehand. If it contains values, then error checking happens. If it's None, then the function resumes as normal