 
 (defn- start-request! [item]
   (if-let [id (:id item)]
-    (if (not (some item '(:sith-lord :request)))
+    (if (not (some item '(:data :request)))
       (let [url (str "http://localhost:3000/dark-jedis/" id)
             request (ajax/GET url :response-format :json :handler handle-sith-lord-response!)]
         (assoc item :request request))

(defonce ^:private items (r/atom (vec (repeat 5 nil)) :validator vector?))

(defn- homeworld-matches? [items current-planet]
  (let [sith-lords-homeworlds (map #(get-in % [:sith-lord "homeworld"]) items)]
     (not (empty? (filter #(= % current-planet) sith-lords-homeworlds)))))

(defn frozen? []


(defn any-misses? [rel]
  {:pre [(some #{rel} '("master" "apprentice"))]}
  (let [loaded-sith-lords (filter some? (map :data @items))]
    (not (empty? (filter nil? (map #(get-in % [rel "id"]) loaded-sith-lords))))))

(defn sith-lords []
  (map :data @items))

(defn- assoc-pending-sith-lord [items index id]
  (if (and (>= index 0) (< index (count items)) (nil? (get-in items [index :id])))
