         
         if let selectedLayer = selectedLayer {
             let item = itemInSuperview()
-            let context = contextForItem(item)
 
             let points = Points(
-                context: context,
                 item: item,
                 atIndex: selectedSegmentioIndex,
                 allItems: segmentioItems,


extension Segmentio.Points {
    
    init(context: Segmentio.Context, item: Segmentio.ItemInSuperview, atIndex index: Int, allItems: [SegmentioItem],
         pointY: CGFloat, position: SegmentioPosition, style: SegmentioStyle) {
        let cellWidth = item.cellFrameInSuperview.width
        
        var startX = item.startX
        var endX = item.endX

        switch position {
        case .fixed(_):
            if context.isFirstCell == false && context.isLastCell == false {
                if context.isLastOrPrelastVisibleCell == true {
                    let updatedStartX = item.collectionViewWidth - (cellWidth * 2)
                        + ((cellWidth - item.shapeLayerWidth) / 2)
                    startX = updatedStartX
                    let updatedEndX = updatedStartX + item.shapeLayerWidth
                    endX = updatedEndX
                }
    
                if context.isFirstOrSecondVisibleCell == true {
                    let updatedEndX = (cellWidth * 2) - ((cellWidth - item.shapeLayerWidth) / 2)
                    endX = updatedEndX
                    let updatedStartX = updatedEndX - item.shapeLayerWidth
                    startX = updatedStartX
                }
            }
            
            if context.isFirstCell == true {
                startX = (cellWidth - item.shapeLayerWidth) / 2
                startX = 0
                endX = startX + item.shapeLayerWidth
            }
            
            if context.isLastCell == true {
                startX = item.collectionViewWidth - cellWidth + (cellWidth - item.shapeLayerWidth) / 2
                endX = startX + item.shapeLayerWidth
            }
            
        case .dynamic:
            // If the collection content view is not completely visible...
            // We have to calculate the final position of the item
            let dynamicWidth = allItems.map { Segmentio.intrinsicWidth(for: $0, style: style) }.reduce(0, +)
            
            if item.collectionViewWidth < dynamicWidth {
                startX = 0
                endX = 0
                var spaceBefore: CGFloat = 0
                var spaceAfter: CGFloat = 0
                var i = 0
                for item in allItems {
                    if i < index {
                        spaceBefore += Segmentio.intrinsicWidth(for: item, style: style)
                    } else if i > index {
                        spaceAfter += Segmentio.intrinsicWidth(for: item, style: style)
                    }
                    
                    i += 1
                }
                // Cell will try to position itself in the middle, unless it can't because
                // the collection view has reached the beginning or end
                if spaceBefore < (item.collectionViewWidth - cellWidth) / 2 {
                    startX = spaceBefore
                } else if spaceAfter < (item.collectionViewWidth - cellWidth) / 2 {
                    startX = item.collectionViewWidth - spaceAfter - item.cellFrameInSuperview.width
                } else {
                    startX = (item.collectionViewWidth / 2) - (cellWidth / 2 )
                }
                endX = startX + cellWidth
            }
        }
        
        startPoint = CGPoint(x: startX, y: pointY)
        endPoint = CGPoint(x: endX, y: pointY)

    fileprivate func moveShapeLayerAtContext() {
        if let indicatorLayer = indicatorLayer, let options = segmentioOptions.indicatorOptions {
            let item = itemInSuperview(ratio: options.ratio)

            let points = Points(
                item: item,
                atIndex: selectedSegmentioIndex,
                allItems: segmentioItems,
