         (subviews as [UIView]).forEach { $0.removeFromSuperview() }
         let totalWidth = frame.width
 
-        func startingPositionAndWidth(_ totalWidth: CGFloat, distribution: XMSegmentItemWidthDistribution, segmentCount: Int, selectedIndex: Int) -> (startingPosition: CGFloat, sectionWidth: CGFloat) {
-
+        func startingPositionAndWidth(_ totalWidth: CGFloat, distribution: XMSegmentItemWidthDistribution, segmentCount: Int) -> (startingPosition: CGFloat, sectionWidth: CGFloat) {
             switch distribution {
             case .fixed:
                 let width = totalWidth / 6

                    tab.imageView?.contentMode = .scaleAspectFit
                    tab.tintColor = i == selectedSegment ? highlightTint : tint
                }
                
                tab.tag = i
                tab.addTarget(self, action: #selector(XMSegmentedControl.segmentPressed(_:)), for: .touchUpInside)
                self.addSubview(tab)

                return (position, width)
            case .flexible:
                let width = totalWidth / CGFloat(segmentCount)
                return (0, width)
            }
        }

