     var scrollInitalized = false
     var closeAnimating = false
     var imageViews = Array<PhotoSlider.ImageView>()
+    var previousPage = 0
 
     public var delegate: PhotoSliderDelegate? = nil
     public var visiblePageControl = true
     public var visibleCloseButton = true
     public var currentPage = 0
+
     public var pageControl = UIPageControl()
     public var backgroundViewColor = UIColor.blackColor()
     

    // MARK: - Constraints
    
    func layoutScrollView() {
        self.pageControl.translatesAutoresizingMaskIntoConstraints = false
        
        let views = ["scrollView": self.scrollView]
        let constraintVertical = NSLayoutConstraint.constraintsWithVisualFormat("V:[scrollView]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views)
        let constraintHorizontal = NSLayoutConstraint.constraintsWithVisualFormat("H:|[scrollView]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views)
        self.view.addConstraints(constraintVertical)
        self.view.addConstraints(constraintHorizontal)

            return
        }
        
        let imageView = self.imageViews[self.currentPage]
        if imageView.scrollView.zoomScale > 1.0 {
            self.generateCurrentPage()
            self.scrollView.scrollEnabled = false
            return
        }
        
        if self.scrollMode == .Rotating {
            return
        }
        

        let offsetX = fabs(scrollView.contentOffset.x - self.scrollPreviewPoint.x)
        let offsetY = fabs(scrollView.contentOffset.y - self.scrollPreviewPoint.y)
        
