Refactored AnalyzeComplexity() to make source more maintainable