    "hunt-and-kill" maze-hunt-and-kill})
 
 #?(:clj
-   (defn synchronous-algorithm [alg-name]
-     (fn [grid]
-       (async/<!! ((algorithm-functions alg-name) grid nil))))
+   (defn synchronous-fn [func]
+     (fn [& opts]
+       (async/<!! (apply func opts))))
    )
 
-(defn algorithm-fn [name options]
-  ;; Commenting this out for now while restructuring the cljs version
-  ;(let [algorithm (synchronous-algorithm name)
-  ;      analyze-distances (fn [maze] (find-distances maze (:distances options)))
-  ;      analyze-path (fn [maze] (find-path maze (:path-to options)
-  ;                                         (analyze-distances maze)))
-  ;      analyze-longest-path (fn [maze]
-  ;                             (let [distances (find-distances maze [0 0])
-  ;                                   distances-from-farthest (find-distances maze (:max-coord distances))]
-  ;                               (find-path maze (:max-coord distances-from-farthest) distances-from-farthest)))
-  ;      analyze (cond
-  ;                (:longest options) analyze-longest-path
-  ;                (:path-to options) analyze-path
-  ;                (:distances options) analyze-distances
-  ;                :else (fn [_] {}))]
-  ;  (fn [grid]
-  ;    (let [maze (algorithm grid)
-  ;          analysis (analyze maze)]
-  ;      (g/grid-annotate-cells maze
-  ;                                {:label (g/xform-values util/base36 analysis)
-  ;                                 :color (g/xform-values #(util/color-cell (:max analysis) %) analysis)}))))
-)
+#?(:clj
+   (defn algorithm-fn [name options]
+     ;; Commenting this out for now while restructuring the cljs version
+     (let [algorithm (synchronous-fn (algorithm-functions name))
+           analyze-distances (fn [maze] ((synchronous-fn find-distances) maze (:distances options)))
+           analyze-path (fn [maze] (find-path maze (:path-to options)
+                                              (analyze-distances maze)))
+           analyze-longest-path (fn [maze]
+                                  (let [distances (find-distances maze [0 0])
+                                        distances-from-farthest (find-distances maze (:max-coord distances))]
+                                    (find-path maze (:max-coord distances-from-farthest) distances-from-farthest)))
+           analyze (cond
+                     (:longest options) analyze-longest-path
+                     (:path-to options) analyze-path
+                     (:distances options) analyze-distances
+                     :else (fn [_] {}))]
+       (fn [grid]
+         (let [maze (algorithm grid)
+               analysis (analyze maze)]
+           (g/grid-annotate-cells maze
+                                  {:label (g/xform-values util/base36 analysis)
+                                   :color (g/xform-values #(util/color-cell (:max analysis) %) analysis)}))))
+     )
+   )

                   (g/link-cells grid cell (:east cell)))]
    [new-grid (if end-run? [] run)]))

(s/defn maze-sidewinder [grid :- g/Grid result-chan]
  (go-loop [grid (assoc grid :algorithm-name "sidewinder")
            [coord & coords] (g/grid-coords grid)
            current-run [coord]]
           (when (and result-chan (g/changed? grid))
             (async/>! result-chan grid))
    (let [[new-grid processed-run] (sidewinder-step (g/begin-step grid) coord current-run)]
      (if (empty? coords)
        (do
          (when result-chan (async/close! result-chan))
          new-grid)
        (recur new-grid
               coords
               (conj processed-run (first coords)))))))

(s/defn maze-aldous-broder [grid :- g/Grid result-chan]
  (go-loop [grid (assoc grid :algorithm-name "aldous-broder")
            current (g/random-coord grid)
            unvisited (dec (g/grid-size grid))]
           (when (and result-chan (g/changed? grid))
             (async/>! result-chan grid))
    (let [cell (g/grid-cell grid current)
          neighbor (rand-nth (g/cell-neighbors cell))
          neighbor-new? (empty? (:links (g/grid-cell grid neighbor)))]
      (if (= unvisited 0)
        (do
          (when result-chan (async/close! result-chan))
          grid)
        (recur (if neighbor-new?
                 (g/link-cells (g/begin-step grid) cell neighbor)
                 (g/begin-step grid))
               neighbor
               (if neighbor-new? (dec unvisited) unvisited))))))

(defn wilsons-loop-erased-walk [grid start-coord unvisited]
  (let [unvisited-set (into #{} unvisited)]

      grid
      (g/link-cells grid cell (rand-nth neighbors)))))

(s/defn maze-binary-tree
  ([grid :- g/Grid] (maze-binary-tree grid nil))
  ([grid :- g/Grid result-chan]
    (go-loop [grid (assoc grid :algorithm-name "binary-tree")
              [coord & coords] (g/grid-coords grid)]
             (if-not coord
               (do
                 (when result-chan (async/close! result-chan))
                 grid)
               (do
                 (when (and result-chan (g/changed? grid))
                   (async/>! result-chan grid))
                 (recur (binary-tree-step (g/begin-step grid) coord) coords))))))

(defn sidewinder-end-run? [cell]
  (let [on-east-side? (not (:east cell))
