         case .ended:
             let velocity = pan.velocity(in: pan.view).y
             let targetOffset = currentOffset - diff + 0.2 * velocity
-            update(animated: true, to: targetOffset, velocity: velocity)
+            update(animated: true, to: targetOffset, velocity: velocity, keepCurrentState: false)
         default: break
         }
         

            return .settled(.collapsed)
        default:
            return .dragging(offset: currentOffset)
        }
    }
    

        scroll.frame.size = CGSize(width: bounds.width, height: bounds.height - (header?.bounds.height ?? 0) - topPadding)
    }
    
    func update(animated: Bool = false, to targetOffset: CGFloat? = nil, velocity: CGFloat? = nil, keepCurrentState: Bool = true) {
        
        // Get actual target
        let target: CGFloat
        if let targetOffset = targetOffset {
            target = targetOffset
        } else if keepCurrentState, case .settled(let settled) = state, let settledOffset = self.offset(forState: settled) {
            target = settledOffset
        } else {
            target = currentOffset
        }
        
        // Get actual offset
        let offset: CGFloat = snapOffsets.dropFirst().reduce(snapOffsets[0]) { closest, current in
            let closestDiff = abs(target - closest)
            let currentDiff = abs(target - current)
            return closestDiff < currentDiff ? closest : current
        }
        
