 
 (defrecord Vertex [id state last-sig-state in outs]
   clojure.lang.IDeref
-  (deref [_] (::val @state))
+  (deref
+    [_] (::val @state))
   IVertex
-  (collect! [_] ((::collect-fn @state) _))
-  (score-collect [_] ((::score-collect-fn @state) _))
+  (collect!
+    [_] ((::collect-fn @state) _))
+  (score-collect
+    [_] ((::score-collect-fn @state) _))
   (connect-to!
     [_ v sig-fn opts]
-    (info (format "%d connecting to %d (%s)" id (:id v) (pr-str opts)))
+    (debug (format "%d connecting to %d (%s)" id (:id v) (pr-str opts)))
     (swap! outs assoc v [sig-fn opts]) _)
-  (disconnect-from!
+  (disconnect-vertex!
     [_ v]
-    (info (format "%d disconnecting from %d" id (:id v)))
+    (debug (format "%d disconnecting from %d" id (:id v)))
     (swap! outs dissoc v)
     _)
-  (disconnect! [_]
-    (info (format "%d disconnecting..." id))
-    (close! in)
+  (close-input! [_]
+    (if @in
+      (do (debug (str id " closing..."))
+          (close! @in)
+          (reset! in nil))
+      (warn (str id " already closed")))
     _)
   (input-channel
-    [_] in)
-  (score-signal [_] ((::score-signal-fn @state) _))
+    [_] (or @in (reset! in (chan))))
+  (score-signal
+    [_] ((::score-signal-fn @state) _))
   (signal!
     [_]
     (let [state @state]



(comment
  (disconnect! a)
  (disconnect! b)
  (disconnect! c)
  (disconnect! d)
  )

   {:id             id
    :state          (atom (merge default-vertex-state state))
    :last-sig-state (atom nil)
    :in             (atom nil)
    :outs           (atom {})}))

(defrecord Graph [state]
