 
 (defmulti msg-controller (fn [[type _] _] type))
 
-(defmethod msg-controller :deployment/listing [[_ msg] state]
+(defmethod msg-controller :deployment/listing 
+  [[_ msg] state]
   (assoc-in state [:deployments] msg))
 
 (defn is-tracking? [msg state]
   (= (:tracking-id msg)
      (get-in state [:deployment :tracking-id])))
 
-(defmethod msg-controller :deployment/up-to-date [[_ {:keys [tracking-id last-id] :as msg}] state]
+(defmethod msg-controller :deployment/up-to-date 
+  [[_ {:keys [tracking-id last-id] :as msg}] state]
   (if (and (is-tracking? msg state)
            (= last-id (:message-id-max (:deployment state))))
     (assoc-in state [:deployment :up-to-date?] true)
     state))
 
-(defmethod msg-controller :deployment/submitted-job [[_ {:keys [id] :as msg}] state]
+(defmethod msg-controller :deployment/submitted-job 
+  [[_ {:keys [id] :as msg}] state]
   (if (is-tracking? msg state)
     (assoc-in state [:deployment :jobs id] (assoc msg :status :submitted)) 
     state))
 
-(defmethod msg-controller :job/peer-assigned [[_ {:keys [peer-id task job-id] :as msg}] state]
+(defmethod msg-controller :job/peer-assigned 
+  [[_ {:keys [peer-id task job-id] :as msg}] state]
   ;(println "Peer assigned " msg)
   (if (is-tracking? msg state)
     (assoc-in state [:deployment :jobs job-id :tasks peer-id] task)
     state))
 
-(defmethod msg-controller :deployment/peer-joined [[_ {:keys [id] :as msg}] state]
+(defmethod msg-controller :deployment/peer-joined 
+  [[_ {:keys [id] :as msg}] state]
   ;(println "Peer joined " msg)
   (if (is-tracking? msg state)
     (update-in state [:deployment :peers] union #{id}) 

          state
          job-ids))

(defmethod msg-controller :deployment/job-statuses [[_ {:keys [finished-jobs incomplete-jobs] :as msg}] state]
  (if (is-tracking? msg state)
    (-> state
        (update-statuses finished-jobs :finished)

;     (update-in state [:deployment :peers] union #{id}) 
;     state))

(defmethod msg-controller :deployment/peer-notify-joined-accepted 
  [[_ {:keys [id] :as msg}] state]
  ;(println "Peer immediate notify joined " msg)
  (if (is-tracking? msg state)
    (update-in state [:deployment :peers] union #{id}) 
