   (select-keys (get (:servers cluster) id) [:tx-queue :rx-queue]))
 
 (defn print-fields [cluster & rest]
-  (mapf (:servers cluster) #(select-keys % (reverse rest))))
+  (utils/mapf (:servers cluster) #(select-keys % (reverse rest))))
 
 (defn ps [cluster]
   (print-fields cluster :id :type :election-timeout :current-term :commit-index))

(defn step [dt system]
  (-> system
      (pump-transmit-queues)
      (update :servers mapf (partial server/update-state dt))
      (update :time + dt)))

(defn step-times [dt times system]

(ns tabby.cluster
  (:require [tabby.server :as server]
            [clojure.tools.logging :refer :all]
            [tabby.utils :as utils]))

;;; Testing and Development things for cluster testing
(defn foreach-server
  ([state f]
   (update state :servers utils/mapf f))
  ([state f & args]
   (apply update state :servers utils/mapf f args)))

(defn- find-peers [id servers]
  (into {} (map (fn [[k v]]
                  [k (select-keys v [:hostname :port])]) (filterv (fn [[k v]] (not= k id)) servers))))

(defn- set-peers [servers]
  (utils/mapf servers (fn [v]
                  (server/set-peers v (find-peers (:id v) servers)))))

(defn write [k cluster]
