                       (:email user))))))
 
 (defn invite-teammates-modal [{:keys [selected-org close-fn show-modal?]} owner]
-  (let [select-user! (fn [{:keys [login] :as user}]
-                       (om/set-state! owner [:org-members-by-login login :selected] true))
-        deselect-user! (fn [{:keys [login] :as user}]
-                         (om/set-state! owner [:org-members-by-login login :selected] false))
-        selected? (fn [{:keys [login] :as user}]
-                    (om/get-state owner [:org-members-by-login login :selected]))
-        set-email! (fn [{:keys [login] :as user} value]
-                       (om/set-state! owner [:org-members-by-login login :email] value))
-        get-email (fn [{:keys [login] :as user}]
-                    (om/get-state owner [:org-members-by-login login :email]))]
+  (letfn [(select-user! [{:keys [login] :as user}]
+            (om/set-state! owner [:org-members-by-login login :selected] true))
+          (deselect-user! [{:keys [login] :as user}]
+            (om/set-state! owner [:org-members-by-login login :selected] false))
+          (selected? [{:keys [login] :as user}]
+            (om/get-state owner [:org-members-by-login login :selected]))
+          (set-email! [{:keys [login] :as user} value]
+            (om/set-state! owner [:org-members-by-login login :email] value))
+          (get-email [{:keys [login] :as user}]
+            (om/get-state owner [:org-members-by-login login :email]))]
     (reify
       om/IWillReceiveProps
       (will-receive-props [_ new-props]

            [frontend.components.pieces.button :as button]
            [frontend.routes :as routes]
            [frontend.state :as state]
            [frontend.utils :as utils :include-macros true]
            [frontend.utils.github :as gh-utils]
            [frontend.utils.vcs :as vcs-utils]
            [goog.string :as gstr]

                                                                                 email (get-email user)]
                                                                             (om/build form/text-field
                                                                                       {:on-change (fn [event]
                                                                                                     (let [trimmed-input (gstr/trim (.. event -currentTarget -value))
                                                                                                           is-valid (valid-email? trimmed-input)]
                                                                                                       (set-email! user trimmed-input)
                                                                                                       (cond
                                                                                                         (and (not is-selected)
                                                                                                              is-valid)
                                                                                                         (select-user! user)
                                                                                                         (and is-selected
                                                                                                              (not is-valid))
                                                                                                         (deselect-user! user))))
                                                                                        :value email
                                                                                        :size :medium
                                                                                        :validation-error (when (and (or is-selected
                                                                                                                         (not (empty? email)))
                                                                                                                     (not (valid-email? email)))
                                                                                                            (str email " is not a valid email"))})))}
                                                               {:type :shrink
                                                                :cell-fn (fn [user]
