 ;;; Utilities
 
 (defn running []
-  (+ @-running
-     (count cached-reactions)))
+  (+ @-running))
 
 (defn capture-derefed [f obj]
   (set! (.-cljsCaptured obj) nil)


(defn with-let-values [key]
  (if-some [c *ratom-context*]
    (cached-reaction array [(reaction-key c) key]
                     nil with-let-destroy)
    (array)))



(declare make-reaction)

(defonce cached-reactions (transient {}))

(defn- cached-reaction [f k1 k2 obj destroy]
  (let [m (if-some [v (get cached-reactions k1)]
            v
            (let [newm (transient {})]
              (assoc! cached-reactions k1 newm)
              newm))]
    (if-some [r (get m k2)]
      (-deref r)
      (if-not (nil? *ratom-context*)
        (let [r (make-reaction
                 f :on-dispose (fn [x]
                                 (when debug (swap! -running dec))
                                 (let [m (get cached-reactions k1)]
                                   (->> (dissoc! m k2)
                                        (assoc! cached-reactions k1)
                                        (set! cached-reactions)))
                                 (when-not (nil? obj)
                                   (set! (.-reaction obj) nil))
                                 (when-not (nil? destroy)
                                   (destroy x))
                                 nil))
              v (-deref r)]
          (->> (assoc! m k2 r)
               (assoc! cached-reactions k1)
               (set! cached-reactions))
          (when debug (swap! -running inc))
          (when-not (nil? obj)
            (set! (.-reaction obj) r))
          v)
        (f)))))

(deftype Track [f args ^:mutable reaction]
  IReactiveAtom

  IDeref
  (-deref [this]
    (if-some [r reaction]
      (-deref r)
      (cached-reaction #(apply f args) f args this nil)))

  IEquiv
  (-equiv [_ other]
