 
     _getCurrentPanes = ->
         ( oPane for oPane in atom.workspaceView.getPaneViews() )
+
+    _getPaneAt = ( iPaneIndex ) ->
+        ( aPanes = _getCurrentPanes() )[ iPaneIndex ] ? aPanes[ aPanes.length - 1 ]

        return PaneUtilities

    @saveItems = ->
        oFirstPane = ( aPanes = _getCurrentPanes() )[ 0 ]

        for oPane, iPaneIndex in aPanes
            for oItem in oPane.getItems()
                oItem.originalPaneIndex = iPaneIndex
                if iPaneIndex > 0

        oFirstPane = ( aPanes = _getCurrentPanes() )[ 0 ]

        for oItem in oFirstPane.getItems()
            oTargetPane = _getPaneAt oItem.originalPaneIndex
            if oItem.originalPaneIndex > 0
                iItemsLength = oTargetPane.getItems().length
                oFirstPane.moveItemToPane oItem, oTargetPane, iItemsLength
