             team.scores[ field ] = computedScore.value[ field ]
             if field != 'contestant_count' and field != 'judge_count' and field != 'popularity_count'
               overall += computedScore.value[ field ]
-          if max_popularity_count == 0
-            team.scores.popularity = 0
-          else
-            team.scores.popularity = computedScore.value.popularity_count / max_popularity_count * 10
+
+          team.scores.popularity = (popularityRanks[computedScore.value.popularity_count] or 0) * 8 + 2
           overall += team.scores.popularity
+
           team.scores.overall = overall
         else
           TeamSchema.eachPath (path) ->

      for field of ret
        ret[ field ] += val[ field ]
    ret
    
  finalize = (key,val) ->
    ret = {}
    [ 'contestant_utility', 'contestant_design', 'contestant_innovation', 'contestant_completeness' ].forEach (field) ->

    ret[ 'judge_count' ] = val.judge_count
    ret[ 'popularity_count' ] = val.popularity_count
    ret

  mrCommand =
    mapreduce:'votes'
    map:map.toString()
    reduce:reduce.toString()
    finalize:finalize.toString()
    out:{inline:1}

  mongoose.connection.db.executeDbCommand mrCommand, (err,result) ->
    if err or not result.documents[0].ok
      console.log err
      console.log result
      return next [err,result]

    computedScores = result.documents[0].results

    popularities = _.uniq computedScores.map((s) -> s.value.popularity_count).sort((a, b) -> a - b)
    popularityRanks = {}
    popularityCount = popularities.length
    for p, rank in popularities
      popularityRanks[p] = rank / (popularityCount - 1)
    console.log popularityRanks

    Team.find {}, (err,teams) ->
      teams.forEach (team) ->
        id = team._id
