     }
     
     private func remove(paneView pane: PaneView) {
-        let parentSplitView = pane.parentSplitView()
-        if parentSplitView?.allSubPaneViews().count == 1 {
-            parentSplitView?.removeFromSuperview()
+        if pane.parentSplitView()?.paneSubviews().count == 1 {
+            pane.parentSplitView()?.removeFromSuperview()
         }
         else {
             pane.removeFromSuperview()
         }
     }
     
-    func split(paneView pane: PaneView) {
+    // MARK: - Split
+
+    private func splitShouldBeVertical() -> Bool {
+        let theEvent = NSApp.currentEvent
+        let optionsKey = NSEventModifierFlags(rawValue: theEvent!.modifierFlags.rawValue & NSEventModifierFlags.AlternateKeyMask.rawValue)
+        let useAlt = (optionsKey == .AlternateKeyMask)
+        return (useAlt == false && self.useHorizontalSplitAsDefault == false) || (useAlt == true && self.useHorizontalSplitAsDefault == true)
+    }
+    
+    private func canAddSubview() -> Bool {
+        let v = self.splitShouldBeVertical()
+        return (self.currentExtent(v) - CGFloat(self.pressure(v))*self.minimumExtent(v) >= self.minimumExtent(v));
+    }
+    
+    public func split(paneView pane: PaneView) {
         let mask = self.window?.styleMask;
         if (mask ==  NSFullScreenWindowMask || mask == NSFullSizeContentViewWindowMask) {
             NSBeep();

        let optionsKey = NSEventModifierFlags(rawValue: theEvent!.modifierFlags.rawValue & NSEventModifierFlags.AlternateKeyMask.rawValue)
        let vertical = (optionsKey == .AlternateKeyMask)
        
        if self.canAddSubview(vertical) == true {
            self.splitPaneView(pane, vertically: vertical)
        }
        else {

        return false
    }
    
    override public func viewDidMoveToWindow() {
        super.viewDidMoveToWindow()
        if (self.selectedPaneView == nil) {
            self.select(paneView: self.lastPaneSubview())
        }
    }
    
    // MARK: - Selection

    override public func mouseUp(theEvent: NSEvent) {
        let downPoint = self.convertPoint(theEvent.locationInWindow, fromView:nil)
        let clickedSubviews = self.paneSubviews().filter({ NSPointInRect(downPoint, $0.frame) })
        if clickedSubviews.count == 1 && clickedSubviews.first!.isKindOfClass(PaneView) {
            self.select(paneView: clickedSubviews.first! as PaneView)
        }
        super.mouseUp(theEvent)
    }
    
    private func select(paneView pane: PaneView?) {
        self.selectedPaneView = pane
        for paneSubview in self.paneSubviews() {
            paneSubview.select(paneSubview == pane)
        }
        if pane != nil {
            self.window?.makeFirstResponder(pane)
        }
    }
    
    // MARK: - Adding & Removing Subviews

    private func pressure(vertically: Bool) -> Int {
        return (vertically == self.vertical) ? max(self.subviews.count, 1) : 1
    }
    
    private func minimumExtent(vertically: Bool) -> CGFloat {
        guard self.delegate != nil, let delegate = self.delegate as! PressureSplitViewDelegate? else {
            return 1
        }
        return (vertically == true) ? delegate.minimumWidth : delegate.minimumHeight
    }
    
    private func currentExtent(vertically: Bool) -> CGFloat {
        return (vertically == true) ? CGRectGetWidth(self.frame) : CGRectGetHeight(self.frame);
    }
    
    private func maximumScreenRect() -> NSRect {
        return self.window!.contentRectForFrameRect(self.window!.screen!.frame)
    }
    
    private func maximumExtent(vertically: Bool) -> CGFloat {
        let rect = self.maximumScreenRect()
        return (self.vertical) ? CGRectGetWidth(rect) : CGRectGetHeight(rect)
    }
    
    // MARK: - Close

    public func close(paneView pane: PaneView) -> Void {
        if self.paneSubviews().count == 1 {
            let alert = NSAlert()
            alert.alertStyle = .WarningAlertStyle
            alert.messageText = NSLocalizedString("Be careful!", comment: "")
