 
 
 (defn get-members [{:keys [conn] :as connector}]
-  (map (fn [path]
-         {:path path :val (System/currentTimeMillis)})
-       (car/wcar conn
-            (car/keys (clojure.string/join [(members-path connector) "/*"])))))
-
+  (into #{} (map (fn [path]
+									 {:path path :val (System/currentTimeMillis)})
+                 (car/wcar conn
+									            (car/keys (clojure.string/join [(members-path connector) "/*"]))))))
 
 (defn join 
   ([connector]
     (join connector host-name))
-  ([{:keys [conn conf state-ref] :as connector} node-name]
+  ([{:keys [conn conf member-event-ch state-ref] :as connector} node-name]
     (let [{:keys [heart-beat-freq]} conf
           path (members-path connector node-name)
           val (System/currentTimeMillis)]

  (clojure.string/join ["/" (clojure.string/join "/" (flatten [group-name "locks" path]))]))


(defn close [{:keys [state-ref]}]
  ;delete connection's state
  (dosync (alter state-ref (fn [state] {}))))
                        
(defn create-connection 

  (let [state-ref (ref {:members #{} :locks #{} :empherals #{}})
        conf2 (merge conf {:group-name group-name :heart-beat-freq heart-beat-freq})
        c (create-connection host conf)
        member-event-ch (chan (sliding-buffer 10))
        member-event-mult (mult member-event-ch)
        connector {:conn c :state-ref state-ref :conf conf2 :host host :group-name group-name
                   :member-event-ch member-event-ch :member-event-mult member-event-mult}
    
		    heart-beat-ch (fixdelay (* heart-beat-freq 1000) 
								              (dosync 
								                (alter state-ref (partial heart-beat connector))))]
      (assoc connector :heart-beat-ch heart-beat-ch))))
        
        