Refactor getLangCompStats function