             }
         }
         
-        let scrollViewShouldStopAtBeginning = {() -> Bool in
-            return contentOffset < 0 && theTargetContentOffset == 0 ?
-                true : false
-        }
+        let scrollViewShouldStopAtBeginning: Bool = contentOffset < 0 && theTargetContentOffset == 0
+
         let scrollViewShouldStopAtEnd = {
             (calculatedOffSet: CGFloat) -> Bool in
-            return calculatedOffSet > contentSizeEndOffset
+            return calculatedOffSet >= contentSizeEndOffset
         }
         switch scrollingMode {
         case let .stopAtEach(customInterval: interval):

                }
                setTargetContentOffset(calculatedOffSet)
            case let .nonStopToCell(resistance):
                let interval = calendarLayout.cellCache[targetSection]![0].4
                let diffResistance = diff * resistance
                if scrollDirection == .horizontal {
                    if scrollViewShouldStopAtBeginning() {
                        calculatedOffSet = 0
                    } else if scrollViewShouldStopAtEnd(calculatedOffSet) {
                        calculatedOffSet = theTargetContentOffset
                    } else {
                        calculatedOffSet = recalculateOffset(diffResistance, interval)
                    }
                } else {

                        calculatedOffSet = scrollViewShouldStopAtEnd(calculatedOffSet) ? theTargetContentOffset : theTargetContentOffset - diffResistance
                        stopSection = calendarLayout.sectionFromOffset(calculatedOffSet)
                    } else {
                        calculatedOffSet = scrollViewShouldStopAtBeginning ? 0 : theTargetContentOffset + diffResistance
                        stopSection = calendarLayout.sectionFromOffset(calculatedOffSet)
                    }
                    let pathPoint = CGPoint( x: targetContentOffset.pointee.x, y: calculatedOffSet)
