 
 extension ViewController: PageableArrayDelegate {
     func loadContentForRange(range: Range<UInt>, pageSize: UInt) {
-        var data = [LocalData]()
-        for _ in 0..<pageSize {
-            data.append(genDataElement())
+        
+        dispatch_async(genDataQueue) {
+            
+            var data = [LocalData]()
+            for _ in 0..<pageSize {
+                data.append(self.genDataElement())
+            }
+            
+            let pageNumber = range.startIndex / pageSize
+            let page = Pageable(page: pageNumber, pageSize: pageSize)
+            dispatch_async(dispatch_get_main_queue()) {
+                
+                self.array.updatePage(page, withElements: data)
+            }
         }
-
-        let pageNumber = range.startIndex / pageSize
-        let page = Pageable(page: pageNumber, pageSize: pageSize)
-        array.updatePage(page, withElements: data)
     }
 }
 

    @IBOutlet weak var collectionView: UICollectionView?
    static let kPageSize: UInt = 40
    var array = PageableArray<LocalData>(capacity: 960, pageSize: ViewController.kPageSize)

    override func viewDidLoad() {
        super.viewDidLoad()

        if start > array.count - ViewController.kPageSize {
            start = array.count - ViewController.kPageSize
        }
        
        let end = start + ViewController.kPageSize
        let range: Range<UInt> = start..<end
        
        loadContentForRange(range, pageSize: ViewController.kPageSize)
        collectionView?.reloadData()
        
        delay(3.0) {
            self.reloadRandomRange()
        }
