                                                    dragging-positions)))
         dragstarts (z/keep-if identity true dragging?)
         dragstops (z/keep-if not false dragging?)
-        new-box-positions (->> mouse/position (z/sample-on mouse/clicks) (z/drop-when dragging? [0 0]))
+        click-positions (->> mouse/position (z/sample-on mouse/clicks) (z/drop-when dragging? [0 0]))
         actions (z/log (z/merge (z/constant (->NoOp))
-                                (z/sample-on dragstarts (z/lift ->StartDrag mouse/position))
+                                (z/lift ->StartDrag (z/sample-on dragstarts mouse/position))
                                 (z/lift (constantly (->StopDrag)) dragstops)
                                 (z/lift ->Drag dragging-positions)
-                                (z/lift ->AddBox new-box-positions)))]
+                                (z/lift ->Click click-positions)))]
     (z/foldp (fn [action state]
-               (action state))
+               (assoc (action state)
+                 :action (pr-str action)))
              init-state
              actions)))
 

  (let [placed-boxes (:placed-boxes state)
        moving-boxes (-> state :drag :moving-boxes)
        resizing-box (-> state :drag :resizing-box)]
    (apply dom/div
           nil
           (concat (map render-solid-box (:placed-boxes state))
                   (map render-ghost-box (if resizing-box
                                           (conj moving-boxes resizing-box)
                                           moving-boxes))))))

(om/root
  (fn [app owner]

      (assoc :drag nil)))

(defrecord NoOp [] IFn (-invoke [_ state] state))
(defrecord Click [pos] IFn (-invoke [_ state] (add-box pos state)))
(defrecord StartDrag [pos] IFn (-invoke [_ state] (start-drag pos state)))
(defrecord Drag [pos] IFn (-invoke [_ state] (drag pos state)))
(defrecord StopDrag [] IFn (-invoke [_ state] (stop-drag state)))
