     @["create#{paneKey.capitalize()}Pane"]()
 
   handleLaunch: (paneKey) ->
-    pane = @[paneKey]
+    pane = @getPaneByType paneKey
     if @lastActivePaneKey is paneKey
-      @hidePane pane, paneKey
+      @lastActivePaneKey = null
+      @updatePaneVisiblityState paneKey, no
     else
-      lastActivePane = @getPaneByType @lastActivePaneKey
-      @hidePane lastActivePane, paneKey, no if lastActivePane
-      @showPane pane, paneKey
+      @lastActivePaneKey = paneKey
+      @updatePaneVisiblityState paneKey, yes
 
-  hidePane: (pane, paneKey, writeToCloud = yes) ->
+  hidePane: (pane, paneKey) ->
     pane.unsetClass "active"
-    @lastActivePaneKey = null
-    @updatePaneVisiblityState paneKey, no if writeToCloud
 
-  showPane: (pane, paneKey, writeToCloud = yes) ->
+  showPane: (pane, paneKey) ->
     if paneKey is "chat"
       @chat.dock.emit "click"
-      return @updatePaneVisiblityState "chat", yes
-
-    pane.setClass "active"
-    @lastActivePaneKey = paneKey
-    @updatePaneVisiblityState paneKey, yes  if writeToCloud
+    else
+      pane.setClass "active"
 
   updatePaneVisiblityState: (paneKey, value) ->
     map          = @paneVisibilityState

      floating : yes

    @chat.on "WorkspaceChatClosed", =>
      @updatePaneVisiblityState "chat", no

  createTerminalPane: ->


    @paneStateRef.on "value", (snapshot) =>
      state  = snapshot.val()
      return unless state

      for own key, value of state
        pane = @getPaneByType key
        if value is no then @hidePane pane, key else @showPane pane, key

  click: ->
    @toggleClass "active"
