Your function here does two things here. I would suggest taking just a ReportAlgorithm into this function and either passing it back (or not). I would suggest creating a separate function to create a ReportAlgorithm out of an identifier.  Ideally, your functions should only be doing one thing.