 
     super options, data
 
-    @createTeamwork()
-
-    if options.playground
-      @doCurlRequest playgroundsManifest, (err, manifests) =>
-        for manifest in manifests when manifest.name is options.playground
-          url = manifest.manifestUrl
-        @handlePlaygroundSelection options.playground, url
-    else
-      @teamwork.on "PanelCreated", =>
-        @doCurlRequest playgroundsManifest, (err, manifest) =>
-          @playgroundsManifest = manifest
-          @dashboard = new TeamworkDashboard
-            delegate : this
-          @teamwork.addSubView @dashboard, null, yes
-
-  createTeamwork: ->
+    @appView   = @getDelegate()
+    @dashboard = new TeamworkDashboard
+      delegate : this
+
+    @doCurlRequest playgroundsManifest, (err, manifest) =>
+      @playgroundsManifest = manifest
+      @dashboard.emit "PlaygroundsFetched", @playgroundsManifest
+
+    @appView.addSubView @dashboard
+
+    @on "NewSessionRequested", (callback = noop) =>
+      @dashboard.hide()
+      @teamwork?.destroy()
+      @createTeamwork()
+      @appView.addSubView @teamwork
+      callback()
+
+    @on "JoinSessionRequested", (sessionKey) =>
+      @setOption "sessionKey", sessionKey
+      @emit "NewSessionRequested"
+
+    @on "ImportRequested", (importUrl) =>
+      @emit "NewSessionRequested"
+      @teamwork.on "WorkspaceSyncedWithRemote", =>
+        @showImportWarning importUrl
+
+    @on "TeamUpRequested", =>
+      @teamwork.once "WorkspaceSyncedWithRemote", ->
+        log "TEAM UP PANPAAAAA!"
+
+  createTeamwork: (options) ->
+    @teamwork = new TeamworkWorkspace options or @getTeamworkOptions()
+
+  getTeamworkOptions: ->
     options               = @getOptions()
     instanceName          = if location.hostname is "localhost" then "teamwork-local" else "kd-prod-1"
-    @teamwork             = new TeamworkWorkspace
+    return {
       name                : options.name                or "Teamwork"
       joinModalTitle      : options.joinModalTitle      or "Join a coding session"
       joinModalContent    : options.joinModalContent    or "<p>Paste the session key that you received and start coding together.</p>"

        {manifestUrl} = manifest

    @doCurlRequest manifestUrl, (err, manifest) =>
      @teamwork.startNewSession @mergePlaygroundOptions manifest, playground
      @teamwork.container.setClass playground
      @teamwork.on "WorkspaceSyncedWithRemote", =>
        {contentDetails} = @teamwork.getOptions()

          {
            title         : "Share"
            cssClass      : "clean-gray"
            callback      : => log "hello"
          }
        ]
        floatingPanes     : [ "chat" , "terminal", "preview" ]
