 ;;     ))
    
 (defn invert-map [m]
-  (reduce (fn [r [k v]] (assoc r v (conj (r v) k))) {} m))
+  (reduce (fn [r [k v]] (map-put r v (conj (map-get r v) k))) (map-new) m))
 
 (defn make-notification [old-datum new-datum old-insertions old-alterations old-deletions delete]
   (trace ["make-notification" old-datum new-datum old-insertions old-alterations old-deletions delete])

   :post-init post-init)
  )

;; these types should really be created on-the-fly to match lhs/rhs relationships
(defrecord LHSEntry [extant version lhs rhs-refs datum]) ;; rhs-refs - resolution of lhs fks to rhs references
(defrecord RHSEntry [rhs lhs-pks]) ;; lhs-pks - {lhs-pk : [lhs-fk-i, ...], ...}

   (fn [[old-lhs-index old-insertions old-alterations old-deletions] [j lhs-pks]]
     (reduce
      (fn [[old-lhs-index old-insertions old-alterations old-deletions] lhs-pk]
	(let [^LHSEntry old-lhs-entry (map-get old-lhs-index lhs-pk)
	      old-lhs-rhs-refs (.rhs-refs old-lhs-entry)
	      new-lhs-rhs-refs (assoc old-lhs-rhs-refs i (assoc (old-lhs-rhs-refs i) j new-rhs))
	      new-lhs-version (inc (.version old-lhs-entry))
