 
     override func scrollViewDidScroll(scrollView: UIScrollView) {
         if scrollView == collectionView {
-            pageControl.frame.origin.x = (scrollView.bounds.width - pageControl.frame.width) / 2 + scrollView.contentOffset.x
-            pageControl.frame.origin.y = scrollView.bounds.height - pageControl.frame.height + scrollView.contentOffset.y - controlInsetBottom
-            pageControl.currentPage = loopedPageForPage(page)
+            updatePageControl()
         }
     }
     

        return identifiers
    }
    
    private var looping: Bool {
        return looped && cellIdentifiers?.count > 1
    }
    
    private var scrolledPage: Int {
        return Int(round(collectionView!.contentOffset.x / collectionView!.bounds.size.width))
    }
    
    private var collectionViewSize: CGSize?
    private var pageControl = UIPageControl()
    
    // MARK: - Actions
    

                                                animated: animated)
    }
    
    private func updatePageControl() {
        pageControl.frame.origin.x = (collectionView!.bounds.width - pageControl.frame.width) / 2 + collectionView!.contentOffset.x
        pageControl.frame.origin.y = collectionView!.bounds.height - pageControl.frame.height + collectionView!.contentOffset.y - controlInsetBottom
        pageControl.currentPage = loopedPageForPage(page + 1)
    }
    
    // MARK: - Functions
    
    private func loopedPageForPage(page: Int) -> Int {
        let loopedPage = page % pageCount
        return loopedPage >= 0 ? loopedPage : pageCount + loopedPage
    }
    
    // MARK: - UIViewController
