         button.titleFont = titleFont
         stackView.addArrangedSubview(button)
         buttons.append(button)
+        return button
     }
     
     func configureUnderlineWidth() {

        buttons.removeAll()
        
        for (index, dataObject) in dataObjects.enumerate() {
            createButton(dataObject, atIndex: index)
        }
        
        configureUnderlineWidth()
        
        if !(selectedIndex < buttons.count) {
            fatalError("Invalid selection for buttons: \(selectedIndex)")
        }
        let selectedButton = buttons[selectedIndex]
        selectedButton.selected = true
    }
    
    func createButton(dataObject: TabDataObject, atIndex index: Int) {
        let button = TabButton(index: index, dataObject: dataObject)
        button.delegate = self
        button.selectedColor = tintColor

    }
    
    func updateTabs() {
        for button in buttons {
            button.selected = button.index == selectedIndex
            button.titleFont = titleFont
