               (get-html-template %))
         names))
 
+(defn processors
+  [state]
+  [[is-om-text? identity]
+   [is-om-code? #(get state % "")]
+   [has-om-if? (fn [[h ifx]]
+                 (if (eval-om-if-expr ifx state)
+                   h
+                   nil))]])
+
 (defn template->hiccup
   [tmplt state]
-  (walk/prewalk (fn [x]
-                  (cond (is-om-text? x) (second x)
-                        (is-om-code? x) (get state (second x) "")
-                        (has-om-if? x) (if (get state (second x))
-                                         x
-                                         nil)
-                        :else x))
+  (walk/prewalk (fn [h]
+                  (reduce (fn [current [pred proc-fn]]
+                            (if-let [r (pred current)]
+                              (proc-fn r)
+                              current))
+                          h
+                          (processors state)))
                 tmplt))
 
 (defn cached-template->hiccup
   [tname state]
-  (template->hiccup (get @template-cache tname) state))
+  (let [r (template->hiccup (get @template-cache tname) state)]
+    r))
 
 #_ (-> "<div>{{a}}</div" html->template (template->hiccup {"a" 33}))
 

  [p]
  (->> p
       split-dbl-brackets
       (map (fn [x] (condp #(= % (count %2)) x
                      0 nil
                      1 [:om-text (first x)]
                      2 [:om-text (-> x drop-delim first)]
                      3 [:om-code (second x)])))
       (filter #(-> % second not-empty))))

(defn grab-om-attrs
  [a ks]

                  (assoc :om-lette (select-keys a ks)))
              a))]
    r))

(defn eval-om-if-expr
  [x state]
  (get state (apply str (mapcat second x))))

(defn html->template
  [h]
