cleaned up and commented AnalyzeOutputFile