         t = "<h3>The IPython Notebook</h3>"
         t += "<h4>Enhanced with SageMathCloud Sync</h4>"
         t += "You are editing this document using the IPython Notebook enhanced with realtime synchronization."
-        if @kernel_id?
-            t += "<h4>Sage mode by pasting this into a cell</h4>"
-            t += "<pre>%load_ext sage</pre>"
-        if @kernel_id?
-            t += "<h4>Connect to this IPython kernel in a terminal</h4>"
-            t += "<pre>ipython console --existing #{@kernel_id}</pre>"
-        if @server.url?
-            t += "<h4>Pure IPython notebooks</h4>"
-            t += "You can also directly use an <a target='_blank' href='#{@server.url}'>unmodified version of the IPython Notebook server</a> (this link works for all project collaborators).  "
-            t += "<br><br>To start your own unmodified IPython Notebook server that is securely accessible to collaborators, type in a terminal <br><br><pre>ipython-notebook run</pre>"
-            t += "<h4>Known Issues</h4>"
-            t += "If two people edit the same <i>cell</i> simultaneously, the cursor will jump to the start of the cell."
+        t += "<h4>Sage mode by pasting this into a cell</h4>"
+        t += "<pre>%load_ext sage</pre>"
+        t += "<h4>Connect to this IPython kernel in a terminal</h4>"
+        t += "<pre>ipython console --existing #{@kernel_id}</pre>"
+        t += "<h4>Pure IPython notebooks</h4>"
+        t += "You can also directly use an <a target='_blank' href='#{@server.url}'>unmodified version of the IPython Notebook server</a> (this link works for all project collaborators).  "
+        t += "<br><br>To start your own unmodified IPython Notebook server that is securely accessible to collaborators, type in a terminal <br><br><pre>ipython-notebook run</pre>"
+        t += "<h4>Known Issues</h4>"
+        t += "If two people edit the same <i>cell</i> simultaneously, the cursor will jump to the start of the cell."
         bootbox.alert(t)
         return false
 

        @doc?.disconnect_from_session()
        @_dead = true

    get_ids: (cb) =>   # cb(err); if no error, sets @kernel_id and @notebook_id, though @kernel_id will be null if not started
        if not @server?
            cb("cannot call get_ids until connected to the ipython notebook server."); return
        @status("Getting notebook id and kernel id...")
        @server.notebooks (err, notebooks) =>
            @status()
            if err
                cb(err); return
            for n in notebooks
                if n.name + '.ipynb' == @file
                    @kernel_id = n.kernel_id  # will be null if kernel not yet started
                    @notebook_id = n.notebook_id
                    cb(); return
            cb("no ipython notebook listed by server with name '#{@file}'")

    initialize: (cb) =>
        async.series([
            (cb) =>

                        @server = server
                        cb(err)
            (cb) =>
                @_init_iframe(cb)
        ], cb)

    # Initialize the embedded iframe and wait until the notebook object in it is initialized.
    # If this returns (calls cb) without an error, then the @nb attribute must be defined.
    _init_iframe: (cb) =>
        @status("Rendering IPython notebook")
        get_with_retry
            url : @server.url
