 ;;               (map #(assoc  % :day day) votes)))
 ;;           votes-by-days))
 
-(defn- scan-votes [player-message-maps hosts]
-  (let [indexed (enumerate player-message-maps)
+(defn- last-cycle [day-ranges]
+  (case (count (last day-ranges))
+    0 :none
+    1 :day
+    2 :night
+    :last-cycle-error)) ;; This should never happen
+
+(defn- scan-votes [player-message-maps hosts first-index cycle-number cycle-type]
+  (let [first-page-index (* (quot first-index POSTS-PER-PAGE) POSTS-PER-PAGE)
+        indexed (->> (enumerate player-message-maps first-page-index)
+                     (drop-while #(<= (first %) first-index))
+                     (into (sorted-map)))
         day-ranges (-> (cycle-changes indexed hosts)
                        (keys)
-                       (to-day-ranges))]
+                       (#(if (= cycle-type :day)
+                           (cons first-index %)
+                           %))
+                       (to-day-ranges))
+        last-cycle (last-cycle day-ranges)]
     (days-into-votes (range 1 (inc (count day-ranges)))
                      (map #(get-votes-in-range indexed %) day-ranges))))
 
-(defn scan-all-votes [url hosts]
-  (let [player-message-maps (get-player-message-maps url)]
-    (scan-votes player-message-maps hosts)))
+(defn scan-all-votes-after [url hosts first-index cycle-number cycle-type]
+  (let [player-message-maps (get-player-message-maps url first-index)]
+    (scan-votes player-message-maps hosts first-index cycle-number cycle-type)))

         (.contains id "spoiler")
         nil)))

(defn death-to-quotes [loc]
  (if (zip/end? loc)
    loc
    (if (or (has-quote? (zip/node loc)) (has-spoiler? (zip/node loc)))

(def ^:private request-header
  {"User-Agent" user-agent})

(def ^:private ^:const POSTS-PER-PAGE 20)

(defn- fetch-page [path]
  (if-not (.contains path "teamliquid.net/forum/") nil
    (try
