         }
     }
     
-    private var loopedCellIdentifiers: [String]? {
-        let identifiers: [String]?
-        if let cellIdentifiers = cellIdentifiers where looping {
-            identifiers = [cellIdentifiers.last!] + cellIdentifiers + [cellIdentifiers.first!]
-        } else {
-            identifiers = cellIdentifiers
-        }
-        return identifiers
-    }
-    
-    var looping: Bool {
+    // MARK: - Override in subclass for dynamic content
+
+    /// Override in subclass for dynamic content or use default implementation for static content.
+    var pageCount: Int {
+        return cellIdentifiers?.count ?? 0
+    }
+    
+    /// Override in subclass for dynamic content or use default implementation for static content.
+    override func collectionView(collectionView: UICollectionView,
+                                 cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell
+    {
+        let page = pageForIndexPath(indexPath)
+        let cellIdentifier = cellIdentifiers![page]
+        let cell = collectionView.dequeueReusableCellWithReuseIdentifier(cellIdentifier, forIndexPath: indexPath)
+        return cell
+    }
+    
+    // MARK: - Variables
+    
+    var currentPage: Int {
+        return Int(round(currentPageFloat))
+    }
+    
+    var currentPageFloat: CGFloat {
+        return currentCellItem - (shouldLoop ? 1 : 0)
+    }
+    
+    var pageControl = UIPageControl()
+    var collectionViewSize: CGSize?
+    
+    // MARK: - Private variables
+    
+    private var shouldLoop: Bool {
         return looped && pageCount > 1
     }
     
-    private var scrolledPage: Int {
-        return Int(round(collectionView!.contentOffset.x / collectionView!.bounds.size.width))
+    private var currentCellItem: CGFloat {
+        return collectionView!.contentOffset.x / collectionViewSize!.width
     }
     
     // MARK: - Actions

    }
    
    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)
    }
    
    private func scrollToPage(page: Int, animated: Bool) {
        let loopedPage = loopedPageForPage(page)
        let scrolledPage = loopedPage + (looping ? 1 : 0)
        let indexPath = NSIndexPath(forItem: scrolledPage, inSection: 0)
        collectionView?.scrollToItemAtIndexPath(indexPath,
                                                atScrollPosition: .CenteredHorizontally,

    // MARK: - Functions
    
    private func loopedPageForPage(page: Int) -> Int {
        return page < 0 || pageCount == 0 ? pageCount + page : page % pageCount
    }
    
    func pageForIndexPath(indexPath: NSIndexPath) -> Int {
        var page = indexPath.row
        if shouldLoop {
            page -= 1
            page = loopedPageForPage(page)
        }
        return page
    }
    
    // MARK: - UIViewController
