    {:beg (fn [vis actx args]
            (let [[ch] args]
              (swap! vis #(assoc-in % [:actxs actx :wait-chs ch] :take))
-             (swap! vis #(update-in % [:chs ch]
-                                    (fn [v]
-                                      (if (nil? v)
-                                        {:id ((:gen-id @vis)) :msgs {}}
-                                        (assoc-in v [:msgs msg] true)))))))
+             (vis-add-ch vis ch)))
     :end (fn [vis actx args]
            (let [[ch result] args]
              (swap! vis #(dissoc-in % [:actxs actx :wait-chs ch]))))}


;; ------------------------------------------------

(def vis-event-handlers
  {"ago"
   {:beg (fn [vis actx args]
           (let [[child-actx] args]
             (swap! vis #(assoc-in % [:actxs child-actx]
                                   {:children {} :wait-chs {}}))
             (swap! vis #(assoc-in % [:actxs actx :children child-actx]
                                   true))))
    :end (fn [vis actx args]
           (let [[child-actx result] args]
             (swap! vis #(dissoc-in % [:actxs child-actx]))

   {:beg (fn [vis actx args]
           (let [[ch msg] args]
             (swap! vis #(assoc-in % [:actxs actx :wait-chs ch] :put))
             (vis-add-ch vis ch)
             (swap! vis #(assoc-in % [:chs ch :msgs msg] true))))
    :end (fn [vis actx args]
           (let [[ch msg result] args]
             (swap! vis #(dissoc-in % [:actxs actx :wait-chs ch]))))}
