       @handleClicked index, event
 
   # DEFAULT ACTIONS
-  handleClicked:(index,event)->
-    pane = @getPaneByIndex index
-    if $(event.target).hasClass "close-tab"
+  handleClicked: (event, handle) ->
+
+    {pane} = handle.getOptions()
+
+    # fixme: make close icon a kdview and check the view instead.
+    if $(event.target).hasClass 'close-tab'
       @blockTabHandleResize = yes
       @removePane pane
       return no
+
     @showPane pane
 
   # DEFINE CUSTOM or DEFAULT tabHandleContainer

    @handles.splice index, 1

    if shouldDetach
      pane.detach()
      handle.detach()
    else

        view       : tabHandleView
        closable   : closable
        sortable   : sortable
        click      : (event) => @handleClicked event, newTabHandle

      @addHandle newTabHandle

