Looks like a candidate for refactoring into a service object, like `LanguageStatsCalculator`