       for i in [0 ... nSamples]
         target = possibleTargets[Math.floor i * possibleTargets.length / (nSamples + 1)]
         suggestions = findSuggestions target
-        reasons = _.reduce suggestions, ((sum, suggestion) ->
-          for suggestion in suggestions
-            for reason in suggestion.reasons
-              sum += switch reason
-                when 'Course instances' then 150
-                when 'IP' then 40
-                when 'Referrer' then 20
-                when 'Name' then 15
-                when 'Domain' then (if getDomain(target) in ['cps.edu', 'mynewcaneyisd.org', 'fsusd.org'] then 1 else 10)
-                when 'Clans' then 0.01
-          sum
-        ), 0
-        if reasons > mostReasons
+        suggestionsScore = scoreSuggestions suggestions, target
+        if suggestionsScore > bestSuggestionsScore
           bestTarget = target
           bestTargetSuggestions = suggestions
-          mostReasons = reasons
+          bestSuggestionsScore = suggestionsScore
           bestGroup = nextLargestGroup
       break
   checkedTopGroups[bestGroup] = true

        suggestions.push schoolName: otherUser.schoolName, reasons: [reason], user: otherUser
  if debugging then console.log '    Done checking referrer', (new Date()) - t0
  suggestions = _.sortBy suggestions, (s) -> (s.schoolName or '').toLowerCase()
  suggestions = _.sortBy suggestions, (s) -> -s.reasons.length
  return suggestions

userCategories = {}
topGroups = {}

      alreadyDone = false
      for schoolName in schoolNames when schoolName?.length > 10 and /,.+,/.test schoolName  # Long enough school name with location info (two commas)
        sharedCount = _.filter(possibleTargets, schoolName: schoolName).length
        if sharedCount > 20 and sharedCount > 0.25 * possibleTargets.length
          console.log 'Already done', schoolName, sharedCount, possibleTargets.length, 'for', field, nextLargestGroup
          alreadyDone = true
      continue if alreadyDone
