Refactored code in FreqAnalysis