             if atom.config.get('pg-hoff.executeAllWhenNothingSelected')
                 selectedText = atom.workspace.getActiveTextEditor().getText().trim()
             else
-                pgHoff.resultsViewPanel.hide()
+                resultsViewPanel.hide()
                 return
 
         return PgHoffQuery.Execute(selectedText)
-            .then (result) ->
+            .then (result) =>
                 complete = []
                 queryStillExecuting = false
                 for resultset in result.resultsets

                        else
                            complete.push(true)
                if queryStillExecuting
                    pgHoff.keepGoing(result.url, complete, pgHoff)

                pgHoff.renderResults(result.resultsets, pgHoff)
            .catch (err) ->
                atom.workspace.getActivePaneItem().alias = null
                pgHoff.resultsViewPanel.hide()
                atom.notifications.addError(err)


        pgHoff = @
        return @listServersView.connect(@listServersViewPanel)
            .then (server) =>
                if server.already_connected
                    atom.notifications.addInfo('Using ' + server.alias)
                else
                    atom.notifications.addSuccess('Connected to ' + server.alias)

                paneItem.alias = server.alias
            .catch (error) =>
                atom.notifications.addError(error)
            .finally =>
                @listServersViewPanel.hide()

    renderResults: (resultsets, pgHoff) ->
        @resultsViewPanel.show();
        @resultsView.update(resultsets)

    keepGoing: (url, complete, pgHoff) ->
        interval = setInterval( () =>
            return PgHoffServerRequest.Get(url, false)
                .then (resultsets) =>
                    for resultset, i in resultsets
                        if resultset.error
                            complete[i] = true
                            atom.notifications.addError(resultset.error)
