     if fabs(distanceFromCenter) > (contentWidth / 3) {
       if distanceFromCenter > 0 {
         reusableViews.shift(1)
+        accumulator++
         viewDelegate?.viewRequiresUpdate(reusableViews[2], viewBefore: reusableViews[1])
       } else {
         reusableViews.shift(-1)
+        accumulator--
         viewDelegate?.viewRequiresUpdate(reusableViews[0], viewAfter: reusableViews[1])
       }
       contentOffset = CGPoint(x: centerOffsetX, y: contentOffset.y)

protocol PagingScrollViewDelegate: class {
  func viewRequiresUpdate(view: UIView, viewBefore: UIView)
  func viewRequiresUpdate(view: UIView, viewAfter: UIView)
}

class PagingScrollView: UIScrollView {

  weak var viewDelegate: PagingScrollViewDelegate?

  var currentPage: CGFloat {
    get {
      let width = bounds.width
      let centerOffsetX = contentOffset.x + width / 2
      return centerOffsetX / width
    }
  }

  var reusableViews = [UIView]()

}

extension PagingScrollView: UIScrollViewDelegate {
  func checkForPageChange() {
    if currentIndex != previousPage {
      viewDelegate?.scrollviewDidScrollToView(reusableViews[Int(currentScrollViewPage)])
      previousPage = currentIndex
    }
  }

  func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) {
    if decelerate {return}
    checkForPageChange()
  }

  func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
    checkForPageChange()
  }

  func scrollViewDidEndScrollingAnimation(scrollView: UIScrollView) {
    checkForPageChange()
  }
}

