             buttonCell.borderMask = borderMask
             
             button.title = dataSource.tabsControl(self, titleForItem: item)
-//            button.state = (item == self.selectedItem) ? NSOnState : NSOffState
+            button.state = (item === self.selectedItem) ? NSOnState : NSOffState // yes triple === to check for instances
             button.highlight(self.isHighlighted)
             
             if let img = dataSource.tabsControl?(self, iconForItem: item) {

        self.addSubview(self.scrollView!)
        
        if self.hideScrollButtons == false {
            
        }
        
        self.startObservingScrollView()

    
    // MARK: - Actions
    
    func scrollTabView(sender: AnyObject?) {
        let forLeft = (sender as? NSButton == self.scrollLeftButton)
        let tab = self.tabButtons().filter({ self.visibilityCondition($0, forLeft: forLeft) }).first
            
        if (tab != nil) {
            NSAnimationContext.runAnimationGroup({ (context) in
                context.allowsImplicitAnimation = true
                tab?.scrollRectToVisible(tab!.bounds)
                }, completionHandler: {
                    self.invalidateRestorableState()
            })
        }
    }
    
    func visibilityCondition(button: NSButton, forLeft: Bool) -> Bool {
        let visibleRect = self.tabsView!.visibleRect
        if forLeft == true {
            return NSMinX(button.frame) < NSMinX(visibleRect)
        }
        else {
            return NSMaxX(button.frame) > NSMaxX(visibleRect) - 2.0*NSWidth(self.scrollLeftButton!.frame)
        }
    }
    
    // MARK: - Reordering
    
    // MARK: - Selection
    
    func selectTab(sender: AnyObject?) {
        guard let button = sender else {
            return
        }
        self.selectedButton = button as? NSButton
        
        for button in self.tabButtons() {
            button.state = (button === self.selectedButton!) ? NSOnState : NSOffState
            button.highlighted = self.isHighlighted
        }
        
        NSApplication.sharedApplication().sendAction(self.action, to: self.target, from: self)
        NSNotificationCenter.defaultCenter().postNotificationName(TabsControlSelectionDidChangeNotification, object: self)
        
        if let currentEvent = NSApp.currentEvent {
            if currentEvent.type == .LeftMouseDown && currentEvent.clickCount > 1 {
                self.editTabButton(self.selectedButton!)
            }
            else if ...
        }
    }
    
    public func selectedItemIndex() -> Int {
