         stackView.orientation = .Horizontal
         stackView.distribution = .FillEqually
         stackView.spacing = 1
-    }
-    
-    func insertTabViewItem(item: NSTabViewItem, index: NSInteger) {
+        
+        addTabButton = NSButton(frame: .zero)
+        addTabButton.translatesAutoresizingMaskIntoConstraints = false
+        addTabButton.setButtonType(.MomentaryChangeButton)
+        addTabButton.image = NSImage(named: NSImageNameAddTemplate)
+        addTabButton.bezelStyle = .ShadowlessSquareBezelStyle
+        addTabButton.bordered = false
+        addTabButton.imagePosition = .ImageOnly
+        stackView.addView(addTabButton, inGravity: .Bottom)
+        addTabButtonHeightConstraint = addTabButton.heightAnchor.constraintEqualToConstant(22)
+        addTabButtonHeightConstraint?.active = true
+        addTabButton.widthAnchor.constraintEqualToAnchor(addTabButton.heightAnchor).active = true
+        addTabButton.target = self
+        addTabButton.action = #selector(addNewTab)
+    }
+    
+    private func createLYTabView(item : NSTabViewItem) -> LYTabView {
         let tabView = LYTabView(tabViewItem: item)
         tabView.tabBarView = self
         tabView.translatesAutoresizingMaskIntoConstraints = false
         tabView.backgroundColor = self.backgroundColor
+        return tabView
+    }
+    
+    func insertTabViewItem(item: NSTabViewItem, index: NSInteger) {
+        let tabView = createLYTabView(item)
         stackView.insertView(tabView, atIndex: index, inGravity: .Center)
-        if stackView.views.count == 1 {
+        if tabViews().count == 1 {
             self.invalidateIntrinsicContentSize()
         }
     }
-    
+
     func tabViews() -> [LYTabView] {
         return self.stackView.viewsInGravity(.Center).flatMap { $0 as? LYTabView }
     }

        }
    }

    let stackView : NSStackView
    
    override public var intrinsicContentSize: NSSize {
        if let aTabView = self.tabViews().first {
            return NSMakeSize(NSViewNoIntrinsicMetric, aTabView.intrinsicContentSize.height+2)
        }
        return NSMakeSize(NSViewNoIntrinsicMetric, 22)
    }
    
    required public init?(coder: NSCoder) {
        stackView = NSStackView(frame: .zero)
        super.init(coder: coder)
        
        stackView.translatesAutoresizingMaskIntoConstraints = false

            selectedBorderColor.setFill()
            NSRectFill(rect)
        }
        let rect = NSInsetRect(addTabButton.frame, 0, 0.5)
        self.backgroundColor.setFill()
        NSRectFill(rect)
    }
    
    @IBAction func addNewTab(sender:AnyObject?) {
        let item = NSTabViewItem()
        item.label = "Untitle"
        self.tabView?.addTabViewItem(item)
        selectTabViewItem(item)
    }
}

