                         ; show the name of the app
                         :else
                         (do
-                          (span {:onClick     #(go  (write-ui app [:submode] "editappname")
-                                                    (write-ui app [:app-id] (<-- :id))
+                          (span {:onClick     #(go  (swap! app-state assoc-in [:submode] "editappname")
+                                                    (swap! app-state assoc-in [:app-id] (<-- :id))
                                                     )}
                                 (div {
 

       (button {:style { :marginRight "30px" :marginBottom "10px" :marginTop "20px"}
                :className "btn-lg btn-default"
                :onClick     #(go
                                (write-ui app [:mode] "edit"))}
               "Cancel")

       ))

     ;(js/alert (str "(get @app-state :ui :editor :mode):" (get @app-state :ui :editor :mode)))
    (let [
           code             (cond
                              (= (get-in @app-state [:ui :editor :mode])  "text")
                                     (js/getCodeMirrorValue)

                              (= (get-in @app-state [:ui :editor :mode])  "blockly")
                                     (js/getBlocklyValue))

           blockly-xml      (if (= (get-in @app-state [:ui :editor :mode])  "blockly")
                              (js/getBlocklyXml))

           app-session-id   (str (js/getappsessionid) )
           ]

      (if
        (= (get-in @app-state [:ui :editor :mode])  "text")
        (do
          (remote !savecode {:id                 app-id
                             :code               (subs code 0 2000)
