       (mapcat (partial apply weighted-pairing-pts pick-pts upset-pts)) ;calculate expected pts per game
       (reduce                                               ;aggregate game results together
         #(let [name (:name %2)]
-            (if (contains? %1 name)
-              (-> (update-in %1 [name :weight] + (:weight %2))
-                  (update-in [name :avg-pts] + (:avg-pts %2)))
-              (assoc %1 name %2)))
+          (if (contains? %1 name)
+            (-> (update-in %1 [name :weight] + (:weight %2))
+                (update-in [name :avg-pts] + (:avg-pts %2)))
+            (assoc %1 name %2)))
         {})
       vals                                                  ;get the aggregation
       (#(vector % fields)))))                               ;preserve the tree

    (->tournament-bracket
      bracket
      (->tournament-teams team-data))
    ->tournament-tree))
  (let [a-comp-b (compare (:seed a) (:seed b))
        plus (fnil + 0)]
    (vector
      (assoc a :avg-pts (* (:weight a) (plus (when (pos? a-comp-b)
                                               upset-pts)
                                             pick-pts)))
      (assoc b :avg-pts (* (:weight b) (plus (when (neg? a-comp-b)
                                               upset-pts)
                                             pick-pts))))))

(defmulti #^{:private true} compute-matchup
          "Compute a matchup.  The first argument is an associative structure that gives the points per a correct pick
          for each round.  The second argument is an associative structure that gives the points per an upset pick for each
          round.  The third and final argument is the matchup data to perform the computation on."
          (fn [_ _ field]
            (cond
              (and (coll? field) (= (count field) 2) (map? (first field)) (map? (last field)))
              :leaf
              (and (coll? field) (= (count field) 2) (coll? (first field)) (coll? (last field)))
              :branch)))
(defmethod compute-matchup :default [_ _ matchup]
  matchup)
(defmethod compute-matchup :branch [pick-pts-fn upset-pts-fn [[upper-field] [lower-field] :as fields]]
