     (assoc :new-item-text "")))
 
 (defmethod step :pop [state _]
-  (update state :stack pop))
+  (-> state
+   (update :completed conj (peek (:stack state)))
+   (update :stack pop)))
 
 (defmethod step :toggle-snoop [state _]
   (update state :snooping? not))
 
 (defmethod step :filter [state {:keys [text]}]
   (assoc state :filter-text text))
+
+(defmethod step :toggle-history [state _]
+  (update state :showing-history? not))
 
 
 ;; VIEW HELPERS


;; VIEW

(defn peek-view [{:keys [stack filter-text snooping?]}]
 (when (not-empty stack)
  [:div.peek-container
   [:p
    [:a
     {:on-click (on-click :toggle-snoop)}
     (if snooping? "peeking..." "peek...")]]
   (when snooping?
     [:div
      [:input


(defonce app-state
  (atom
    {:stack ()
     :new-item-text ""
     :snooping? false
     :filter-text ""
     :completed ()
     :showing-history? false}))

(defmulti step
  (fn [_ {:keys [id]}]
