 
 ;; getter
 (defn get-ds
-  [keychain]
+  [keychain & em]
   (log/trace "get-ds " keychain)
-   (if (clj/empty? keychain)
-     (throw (IllegalArgumentException. "keychain vector must not be empty"))
-     (let [k (apply ekey/keychain-to-key keychain)
-           e (.get (ds/datastore) k)]
-       (log/trace "key: " k)
-       (log/trace "e: " e)
-       ;; throw  EntityNotFoundException
-                  ;; (catch EntityNotFoundException e nil)
-                  ;; (catch DatastoreFailureException e (throw e))
-                  ;; (catch java.lang.IllegalArgumentException e (throw e)))]
-       (PersistentEntityMap. e))))
-
-;; co-constructor
+   (cond
+     (ekey/improper-keychain? keychain)
+     (get-kinded-emap keychain)
+     (ekey/proper-keychain? keychain)
+     (get-proper-emap keychain)
+     :else
+     (throw (IllegalArgumentException. (str "Invalid keychain" keychain)))))
+
+   ;; (if (clj/empty? keychain)
+   ;;   (throw (IllegalArgumentException. "keychain vector must not be empty"))
+   ;;   (let [k (ekey/keychain-to-key keychain)
+   ;;         e (.get (ds/datastore) k)]
+   ;;     (log/trace "key: " k)
+   ;;     (log/trace "e: " e)
+   ;;     ;; throw  EntityNotFoundException
+   ;;                ;; (catch EntityNotFoundException e nil)
+   ;;                ;; (catch DatastoreFailureException e (throw e))
+   ;;                ;; (catch java.lang.IllegalArgumentException e (throw e)))]
+   ;;     (PersistentEntityMap. e))))
+
+;; pull constructor
 (defmulti entity-map*
-  "entity-map co-constructor.  Retrieve entities with exact, complete
-  match; if no matches, throw exception."
+  "Pull constructor.  Retrieve entities with exact, complete
+  match."
   ;; FIXME:  implement map matching
   ;; FIXME:  throw notfound exception
     (fn [keychain & valmap]
-      ;; (log/trace "keychain: " keychain)
-      ;; (log/trace "type keychain: " (type keychain))
-      ;; (log/trace "valmap: " valmap)
-      ;; (log/trace "type valmap: " (type valmap))
-      ;; (log/trace "first valmap: " (first valmap))
-      ;; (log/trace "type first valmap: " (type (first valmap)))
+      (log/trace "keychain: " keychain)
+      (log/trace "type keychain: " (type keychain))
+      (log/trace "valmap: " valmap)
+      (log/trace "type valmap: " (type valmap))
+      (log/trace "first valmap: " (first valmap))
+      (log/trace "type first valmap: " (type (first valmap)))
       ;; (flush)
       [(type keychain) (type (first valmap))])) ;; (first valmap) should be the val map
 (defmethod entity-map* [clojure.lang.PersistentVector nil]

        (.setProperty e (subs (str k) 1) (get-val-ds v)))
      (PersistentEntityMap. e))))

;; OBSOLETE - use entity-map for consistency with hash-map, array-map, etc
(defn emap
  "create PersistentEntityMap object"

   (into-ds! keychain em))
  ([keychain]
   (into-ds! keychain)))

(defn into-ds!
;; FIXME: convert to [keychain & em]
