       (let [fdata (read-index-file dbname dbkey)]
         (if-let [key-data (->> (get datum dbkey)
                                (get fdata))]
-          nil))))
+          (let [new-key-data (conj key-data
+                                   (:uuid datum))]
+            (spit (index-path dbname dbkey)
+                  (merge fdata
+                         {(get datum dbkey) new-key-data})))
+          (spit (index-path dbname dbkey)
+                (merge fdata
+                       {(get datum dbkey) #{(:uuid datum)}}))))))
+
+(defn- write-index-keys!
+  [dbname datum]
+  (doseq [datum-key (keys (dissoc datum :uuid))]
+    (write-index-key! dbname datum-key datum)))
 
 (defn create!
   "Creates a new database with dbname and make initial directories and

       (let [res-doc (try (read-string (slurp fname))
                          (catch Exception e))]
         res-doc)))
  ([dbname uuid col]
     nil))

(defn get-docs
  "With one argument it returns all docs in dbname, with two arguments

       (get-doc dbname uuid)))
  ([dbname uuids]
     (for [uuid uuids]
       (get-doc dbname uuid)))
  ([dbname kv option]
     (let [uuids (-> (read-index-file dbname (key (first kv)))
                     (get (val (first kv))))]
       (if option
         (get-docs dbname uuids)
         uuids))))

(defn put-doc!
  "Put data into dbname, data must be a clojure map. However the
