             lastIndex = numberOfPhotos - 1
         }
         
+        //
+        for page in visiblePages {
+            if let pageIndex = visiblePages.indexOf(page) {
+                if (pageIndex < firstIndex || pageIndex > lastIndex) {
+                    recycledPages.append(page)
+                    page.prepareForReuse() //TODO: - it need to change
+                    page.removeFromSuperview()
+                    print("Removed page at index \(pageIndex)")
+                }
+            }
+        }
+        
+        let visibleSet = Set(visiblePages)
+        visiblePages = Array(visibleSet.subtract(recycledPages))
+        
+        while (recycledPages.count > 2) {
+            recycledPages.removeFirst()
+        }
+        
+        
+        //
         for var index = firstIndex; index <= lastIndex; index++ {
             if isDisplayingPageForIndex(index) {
                 continue

    
    // photo's paging
    private var visiblePages = [SKZoomingScrollView]()//: Set<SKZoomingScrollView> = Set()
    private var initialPageIndex: Int = 0
    private var currentPageIndex: Int = 0
    

        
        // reset local cache
        visiblePages.removeAll()
        recycledPages.removeAll()
        
        // set content offset
        pagingScrollView.contentOffset = contentOffsetForPageAtIndex(currentPageIndex)
