             title.textContent = 'Executing...'
 
         return tab
+
+    tabs: ->
+        Array.from(@element.children[1].children[0].children)
+        .filter((e) -> e.tagName == 'LI')
+
+    selectNearestTab: (index) ->
+        tabs = @tabs()
+        for t, i in tabs
+            if i > index and not @closedTabs.has(i)
+                return @selectTab(i)
+        for i in [tabs.length-1...-1]
+            if not @closedTabs.has(i)
+                return @selectTab(i)
+
+    tabCount: ->
+        @resultsets.length - @closedTabs.size
+
+    closeUI: ->
+        while (@element.firstChild)
+            @element.removeChild(@element.firstChild)
+        @element.style.display = 'none'
 
     selectTab: (index) ->
         resultset = @resultsets[index]

        closeIcon.classList.add 'close-icon'
        closeIcon.onclick = (e) =>
            tab.style.display = 'none'
            index = parseInt(tab.getAttribute('index')) - 1
            if index >= 0
                @selectTab(index)
            else
                while (@element.firstChild)
                    @element.removeChild(@element.firstChild)

        if resultset.statusmessage?
            title.textContent = resultset.statusmessage

        title.classList.add 'title'

        attachIcon = tab.appendChild document.createElement('div')
        attachIcon.classList.add 'close-icon'
        attachIcon.classList.add 'pin-icon'
        attachIcon.onclick = (e) =>
