         :else
           (recur (.-parentNode elem) container)))
 
-(defn toggle! [elem container]
-  (cond (d/has-class? elem "condensed")
-        (arrange! elem container)
-        (d/has-class? elem "arranged")
-        (do (condense! elem (find-arranged-parent (.-parentNode elem)
-                                                  container))
-            (d/set-styles! elem {:display "block"}))))
+(defn toggle! [target-elem arranged-elem container]
+  (if (d/has-class? target-elem "condensed")
+    (d/remove-class! target-elem "condensed")
+    (d/add-class! target-elem "condensed"))
+  (arrange! arranged-elem container))
 
 (defn set-toggle-on-click! [elem container]
   (events/listen (d/single-node elem) "click"
                  (fn [event]
-                   (loop [elem (.-target event)]
-                     (when elem
-                       (if (and (gdom/isElement elem)
-                                (d/has-class? elem "collection")
-                                (or (d/has-class? elem "condensed")
-                                    (d/has-class? elem "arranged")))
+                   (loop [t (.-target event)]
+                     (when t
+                       (if (and (gdom/isElement t)
+                                (d/has-class? t "collection")
+                                (or (d/has-class? t "condensed")
+                                    (d/has-class? t "arranged")))
                          (do (.stopPropagation event)
                              (.preventDefault event)
-                             (toggle! elem container))
-                         (recur (.-parentNode elem))))))))
+                             (toggle! t elem container))
+                         (recur (.-parentNode t))))))))

                             :overflow "hidden"
                             :text-overflow "ellipsis"})))

(defn condense! [elem container]
  (remove-all-styles! elem)
  (d/set-styles! elem {:white-space "pre"})
  (d/remove-class! elem "arranged")
  (when (overflow? elem container)
    (when (d/has-class? elem "collection")
      (condense-collection! elem container))))

(defn find-arranged-parent [elem container]
  (cond (= container elem)

(def next-state rest)

(defn arrange-keyval! [state elem container]
  (let [[key separator val] (d/children elem)]
    (arrange-element! state key container)
    (arrange-element! state val container)
