   atom.workspace.getActivePane()
 
 debug = (msg) ->
+  console.log msg
   return unless atom.config.get('paner.debug')
-  console.log msg
 
 splitPane = (pane, direction, params) ->
   method = "split#{_.capitalize(direction)}"

    return if atom.workspace.getPanes().length < 2
    currentPane = getActivePane()
    container = currentPane.getContainer()
    root = container.getRoot()
    orientation = if direction in ['top', 'bottom'] then 'vertical' else 'horizontal'

    # If there is multiple pane in window, root is always instance of PaneAxis
    PaneAxis ?= root.constructor

    if root.getOrientation() isnt orientation
      container.setRoot(new PaneAxis({container, orientation, children: [root]}))
      root = container.getRoot()

    newPane = buildPane()
    switch direction
      when 'top', 'left' then root.addChild(newPane, 0)
      when 'right', 'bottom' then root.addChild(newPane)

    # [NOTE] Order is matter.
    # Calling moveAllPaneItems() before setRoot() cause first item blank
    moveAllPaneItems(currentPane, newPane)
    currentPane.destroy()

    if atom.config.get('paner.mergeSameOrientaion')
      for axis in getAllPaneAxis(root) when isSameOrientationAsParent(axis)
        debug("merge to parent!!")
        mergeToParentPaneAxis(axis)

    newPane.activate()

  results

isSameOrientationAsParent = (paneAxis) ->
  paneAxis.getOrientation() is paneAxis.getParent().getOrientation?()

buildPane = ->
  new Pane
