   ([id] (show id {}))
   ([id options]
    (let [account (accounts/find-by-id (env :db) id)]
-     (layout
-       (format "Account - %s" (:name account))
-       (assoc options :side-bar (budget-monitors (:entity-id account)))
-       (html
-         [:table.table.table-striped.table-hover
-          [:tr
-           [:th.text-right "Date"]
-           [:th "Description"]
-           [:th.text-right "Amount"]
-           [:th.text-right "Balance"]
-           [:th "&nbsp;"]]
-          (map transaction-item-row
-               (transactions/items-by-account (env :db) id))]
-         [:a.btn.btn-primary {:href (-> (path "/entities"
-                                              (:entity-id account)
-                                              "transactions"
-                                              "new")
-                                        (query {:redirect (url-encode (format "/accounts/%s" id))})
-                                        format-url)}
-          "Add"]
-         "&nbsp;"
-         [:a.btn.btn-default {:href (format "/entities/%s/accounts" (:entity-id account))}
-          "Back"])))))
+     (accounts-layout
+       (format "Account - %s" (:name account)) (:entity-id account) options
+       [:table.table.table-striped.table-hover
+        [:tr
+         [:th.text-right "Date"]
+         [:th "Description"]
+         [:th.text-right "Amount"]
+         [:th.text-right "Balance"]
+         [:th "&nbsp;"]]
+        (map transaction-item-row
+             (transactions/items-by-account (env :db) id))]
+       [:a.btn.btn-primary {:href (-> (path "/entities"
+                                            (:entity-id account)
+                                            "transactions"
+                                            "new")
+                                      (query {:redirect (url-encode (format "/accounts/%s" id))})
+                                      format-url)}
+        "Add"]
+       "&nbsp;"
+       [:a.btn.btn-default {:href (format "/entities/%s/accounts" (:entity-id account))}
+        "Back"]))))
 
 (defn- form-fields
   "Renders the form fields for an account"

     [:td "&nbsp;"]]
    (map account-and-children-rows accounts)))

(defn index
  "Renders the list of accounts"
  ([entity-id] (index entity-id {}))
  ([entity-id options]
   (layout
     "Accounts" (assoc options :side-bar (budget-monitors entity-id))
     (html
       [:table.table.table-striped
        [:tr
         [:th.col-sm-6 "Name"]
         [:th.col-sm-4.text-right "Balance"]
         [:th.col-sm-2 "&nbsp;"]]
        (let [groups (accounts/select-nested-by-entity-id (env :db) (Integer. entity-id))]
          (map account-rows groups))]
       [:a.btn.btn-primary
        {:href (format "/entities/%s/accounts/new" entity-id)
         :title "Click here to add a new account."}
        "Add"]))))

(defn- transaction-item-row
  [{:keys [transaction-id

(defn edit
  "Renders the edit form for an account"
  [id-or-account]
  (let [account (if (map? id-or-account)
                  id-or-account
                  (accounts/find-by-id (env :db) (Integer. id-or-account)))]
    (accounts-layout
      "Edit account" (:entity-id account) {}
      [:div.row
       [:div.col-md-6
        [:form {:action (format "/accounts/%s" (:id account))
