     private var imageView: UIImageView?
     private var completion: (() -> Void)?
     
-    private var isRotating: Bool = false
+    private var isFlipping: Bool = false
     private var isStopping: Bool = false
     
     private var currentIndex: Int = 0

    }
    
    // start half or full flip animation
    private func flip(progress: Progress) {
        CATransaction.begin()
        CATransaction.setCompletionBlock({
            self.flipComplete(progress)
        })
        
        let transition = CATransition()
        
        transition.startProgress = progress.rawValue
        transition.endProgress = progress.rawValue + 0.5
        transition.type = TRANSITION_TYPE
        transition.subtype = TRANSITION_SUBTYPE
        transition.duration = speed

        if let completion = self.completion {
            completion()
        }
    }
    
    
    // stop flipping as soon as image with index is reached
    func stopFlipping(index: Int, completion: () -> Void) {
        isStopping = true
        stopIndex = index
        self.completion = completion
    }
}
