           (.sortable (js/$ "#placed") (clj->js {
                                                 :items "li:not(.ui-state-disabled)"
                                                 :connectWith ".connectedSortable"
-                                                :update (fn [e ui] (re-sort (-> e .-target .-childNodes)))
+                                                :update (fn [e ui] (update-voted-out (-> e .-target .-childNodes)))
                                                 }))
           (.disableSelection (js/$ "#placed")))))
 

        (dec max-points)
        (rest entry))))))

(defn leader-board [entries contestants]
  [:ul
   (for [entry entries]
     ^{:key (:id entry)} [:li.ui-state-default 
                          [:div {:class "points"} (:name entry)
                           [:div (calculate-points-for-entry (create-contestant-list entries (:id entry) contestants))]]])])

(defn create-placed-list [placed]
  (into [] (sort #(compare (:out %2) (:out %1)) placed)))

(defn create-contestant-list [entries selected-entry contestants]
  (let [contestant-order (:order (first (filter #(= selected-entry (:id %)) entries)))]
    (map
     #(first (filter (fn [contestant] (= (:id contestant) %)) contestants))
     contestant-order)))

(defn entries-display [entries selected-entry]
    [:div
     [:select {:on-change #(swap! selected-entry (fn [] (int (-> % .-target .-value))))}
      (for [entry entries]
        ^{:key (:id entry)} [:option {:value (:id entry)}
                             (:name entry)])]
     [lister (create-contestant-list entries @selected-entry @contestants) "selected-entry"]])


(defn home []
  [:div [:h2 "Phil & Will's Survivor 30 Bootlist"]
   [leader-board @entries @contestants]
   [entries-display @entries selected-entry]
   [lister (create-placed-list  (filter #(true? (:locked %)) @contestants)) "placed"]
   [lister (filter #(= 0 (:out %)) @contestants) "contestants"]])

(defn update-c [cs ids]
  (if (empty? ids)
    cs
    (let [c (first (filter #(= (:id (first ids)) (:id %)) cs))
          new-cs (remove #(= (:id (first ids)) (:id %)) cs)
          new-c (assoc c :out (:out (first ids)))]
      (recur
       (into [] (conj new-cs new-c))
       (rest ids)))))

(defn re-sort [new-placed-list]
  (let [ids (map-indexed (fn [index item] (hash-map :id (int (.-id item)) :out (- 18 index))) new-placed-list)]
    (swap! contestants (fn [] (update-c @contestants (into [] ids))))))

(defn home-did-mount []
  (js/$ (fn []

                         [:img {:src (str "/images/" (:name item) ".png")}]
                         [:div (:name item)]])])

(defn create-contestant-list [entries selected-entry voted-out-list]
  (let [entry-contestant-order (:order (first (filter #(= selected-entry (:id %)) entries)))]
            (map
             #(first (filter (fn [voted-out-entry] (= (:id voted-out-entry) %)) voted-out-list))
             entry-contestant-order)))

(defn calculate-points-for-entry
  ([entry] (calculate-points-for-entry 0 18 entry))
  ([points max-points entry]
   (if (empty? entry)
     points
     (let [new-points (if (nil? (first entry))
                        0
                        (Math/abs (- max-points (:out (first entry)))))]
       (recur
