         root.addChild(newPane)
     @movePane thisPane, newPane
 
-    if root isnt paneInfo.root
-      container.setRoot(root)
-      @reparentChildren root, orientation
+    container.setRoot(root) if root isnt paneInfo.root
+    @reparent(axis) for axis in @getAllAxis(root)
 
     container.destroyEmptyPanes()
     newPane.activateItemAtIndex index
     newPane.activate()
 
+  getAllAxis: (root, list=[]) ->
+    for child in root.getChildren()
+      if child instanceof @PaneAxis
+        list.push child
+        @getAllAxis child, list
+    return list
+
+
   isEqualOrientationAxis: (axis, orientation) ->
     (axis instanceof @PaneAxis) and (axis.getOrientation() is orientation)
 
-  reparentChildren: (parent, orientation) ->
-    console.log "Reparent"
-    for axis in parent.children when @isEqualOrientationAxis(axis, orientation)
-      console.log "Reparent: found"
+  reparent: (axis) ->
+    parent = axis.getParent()
+    # console.log "parent: #{parent.getOrientation()}, me: #{axis.getOrientation()}"
+    if parent.getOrientation() is axis.getOrientation()
+      # console.log "match!"
       children   = axis.getChildren()
       firstChild = children.shift()
       firstChild.setFlexScale()

{CompositeDisposable} = require 'atom'
_ = require 'underscore-plus'

module.exports =
  PaneAxis: null
  Pane:     null


  copyPaneAxis: (paneAxis) ->
    {container, orientation} = paneAxis
    new paneAxis.constructor({container, orientation, children: paneAxis.getChildren()})

  # [FIXME]
  # Occasionally blank pane, remain on original pane position.
