        clojure.pprint/pprint)
 
   (->> (mc/find-maps (:db @mongo-state) "urls" {:article (first spon-url)})
-       (mapv #(assoc % :tweet  (mc/find-map-by-id (:db @mongo-state) "tweets" (:tweet %) [:in_reply_to_status_id_str :text :user.screen_name :retweeted :id_str])))
-       (map #(-> % :tweet :text))
-       clojure.pprint/pprint)
-
+       (mapv #(assoc % :tweet  (mc/find-map-by-id (:db @mongo-state) "tweets" (:tweet %) [:in_reply_to_status_id_str :text :user.screen_name :retweeted_status.id_str :id_str])))
+       count
+       clojure.pprint/pprint)
+
+
+  (let [tweet (-> (mc/find-maps (:db @mongo-state) "tweets" {:created_at {$gt (t/today)}})
+                  rand-nth)
+        record-urls (-> tweet :entities :urls)
+        expanded-urls (if (empty? record-urls)
+                        nil
+                        (map #(let [expanded-url (expand-url (:expanded_url %))]
+                                (if (:url expand-url)
+                                  expanded-url
+                                  (assoc expanded-url :url (:expanded_url %)))) record-urls))
+        articles (if (nil? expanded-urls)
+                   nil
+                   (map #(assoc % :article (-> (mc/find-one-as-map (:db @mongo-state) "articles" {:url (:url %)}) :_id)) expanded-urls))]
+    (-> (vec [(:text tweet) (trace-parent tweet []) articles])
+        clojure.pprint/pprint))
+
+  (->> (mc/find-maps (:db @mongo-state) "origins")
+       (map #(count (:ancestors %)))
+       (remove #(< % 2))
+       clojure.pprint/pprint)
 
   )

                                  (assoc expanded-url :url (:expanded_url %)))) record-urls))
        articles (if (nil? expanded-urls)
                   nil
                   (map #(assoc % :article (-> (mc/find-one-as-map (:db @mongo-state) "articles" {:url (:url %)}) :_id)) expanded-urls))]
    (if (nil? articles)
      nil
      (doall
       (map
        #(if (:article %)
           (do (store-url (assoc % :record oid :ts ts :source source))
               (update-in (mc/find-map-by-id (:db @mongo-state) "articles" (:article %)) [:ts] (fn [x] (f/unparse (:custom-formatter @mongo-state) x))))
           (let [article (store-article (assoc % :ts ts))]
             (do (store-url (assoc % :article (:_id article) :record oid :ts ts :source source))
                 (do (store-url (assoc % :record oid :ts ts :source source))
                     (update-in article [:ts] (fn [x] (f/unparse (:custom-formatter @mongo-state) x)))))))
        articles)))))

                                    :content-type content-type})))))))


(defn trace-parent
  "Compute ancestor trace of given tweet"
  [tweet origins]
  (let [replied-id (:in_reply_to_status_id_str tweet)
        retweeted-status-id (-> tweet :retweeted_status :id_str)
        parent (if replied-id
                 (mc/find-one-as-map (:db @mongo-state) "tweets" {:id_str replied-id})
                 (if retweeted-status-id
                   (mc/find-one-as-map (:db @mongo-state) "tweets" {:id_str retweeted-status-id})
                   nil))]
    (if parent
      (trace-parent parent (into origins [(:_id parent)]))
      origins)))


(defn store-url [{:keys [article record ts source]}]
  (mc/insert-and-return
   (:db @mongo-state)
