             for position in 0..<self.selectedIndexPath!.length {
                 var pos = position
                 if position == self.selectedIndexPath!.length {
-                    pos = KPCJumpBarControlAccessoryMenuLabelTag - 1;
+                    pos = KPCJumpBarControlAccessoryMenuLabelTag - 1
                 }
     
-                let segmentControl = self.segmentControlAtLevel(pos);
+                let segmentControl = self.segmentControlAtLevel(pos)!
     
                 if ((overMargin + segmentControl.minimumWidth() - segmentControl.frame.size.width) < 0) {
                     var frame = segmentControl.frame

    
            var baseX: CGFloat = CGFloat(0);
            for position in 0..<self.selectedIndexPath!.length {
                let segmentControl = self.segmentControlAtLevel(position);
                var frame = segmentControl.frame;
                frame.origin.x = baseX;
                baseX += frame.size.width;
                segmentControl.frame = frame;
            }
        }
    }

    
    // MARK: - Layout
    
    private func removeSegmentsFromLevel(level: Int) {
        if level < self.selectedIndexPath?.length {
            for l in level..<self.selectedIndexPath!.length {
                if let superfluousSegmentControl = self.segmentControlAtLevel(l, createIfNecessary: false) {
                    superfluousSegmentControl.removeFromSuperview()
                }
            }
        }
    }
    
    private func layoutSegmentsIfNeeded(withNewSize size:CGSize) {

        if (self.hasCompressedSegments)  {
            self.layoutSegments();
        }
        else {
            let lastSegmentControl = self.segmentControlAtLevel(self.selectedIndexPath!.length)!
            let endFloat = lastSegmentControl.frame.size.width + lastSegmentControl.frame.origin.x
    
            if (size.width < endFloat) {
                self.layoutSegments()
            }
        }
    }
