   "Main function for creating indicies.
    Reads in datafile, tokenizes, sorts, and writes to files"
   [jsonfile]
+  (io/delete-file MAPDB-FILENAME)
   (let [docs (doc-seq-from-file jsonfile)
         token-seq (token-seq-from-docs docs)
         url-seq (create-url-seq docs)]

  Dictionary file: term\tdocument_frequency
  Postings list file: term\tpost1;post2;"
  [term-postings-mapping]
  (with-open [dictionary-file (io/writer DICTIONARY-FILENAME)]
    (let [postings-list-map (spicerack/open-hashmap MAPDB POSTINGS-LIST-DB)]
      (doseq [[term postings] term-postings-mapping]
        (.write dictionary-file
                (str term "\t" (count (distinct postings)) "\n"))


(defn write-url-mapping-to-file
  [url-seq]
  (with-open [db (spicerack/open-database MAPDB-FILENAME)]
    (let [url-map (spicerack/open-hashmap db URL-MAPPING-DB)]
     (doseq [[doc-id url] url-seq]
       (spicerack/put! url-map doc-id url)))))

(defn create-url-seq
  [doc-seq]
