             presentedControllerView.frame = f
 
             }, completion: {(completed: Bool) -> Void in
-                transitionContext.completeTransition(!transitionContext.transitionWasCancelled())
+                let cancelled = transitionContext.transitionWasCancelled()
+                transitionContext.completeTransition(!cancelled)
         })
     }
     

        case (.Ended):
            self.isInteractive = false
            let velocityRequiredToPresent = -CGRectGetWidth(gesture.view!.bounds) * UIApplication.sharedApplication().wmf_tocRTLMultiplier
            let velocityRequiredToDismiss = CGRectGetWidth(gesture.view!.bounds)
            
            let velocityX = gesture.velocityInView(gesture.view).x
            if velocityX * UIApplication.sharedApplication().wmf_tocRTLMultiplier > velocityRequiredToDismiss{
                self.cancelInteractiveTransition()
                return
            }
            
            if velocityX > velocityRequiredToPresent{
                self.finishInteractiveTransition()
                return
            }
            
            let progressRequiredToPresent = 0.33
            
            if(self.percentComplete >= CGFloat(progressRequiredToPresent)){
                self.finishInteractiveTransition()
                return
            }
            
            self.cancelInteractiveTransition()
            
        case (.Cancelled):
            self.isInteractive = false
            self.cancelInteractiveTransition()
            
        default :
            break

            DDLogVerbose("TOC transition progress: \(transitionProgress)")
        case .Ended:
            self.isInteractive = false
            let velocityRequiredToPresent = -CGRectGetWidth(gesture.view!.bounds) * UIApplication.sharedApplication().wmf_tocRTLMultiplier
            let velocityRequiredToDismiss = -velocityRequiredToPresent
            
            let velocityX = gesture.velocityInView(gesture.view).x
            if velocityX*velocityRequiredToDismiss > 1 && abs(velocityX) > abs(velocityRequiredToDismiss){
                finishInteractiveTransition()
                return
            }
            
            if velocityX*velocityRequiredToPresent > 1 && abs(velocityX) > abs(velocityRequiredToPresent){
                cancelInteractiveTransition()
                return
            }
            
            let progressRequiredToDismiss = 0.50
            
            if(self.percentComplete >= CGFloat(progressRequiredToDismiss)){
                finishInteractiveTransition()
                return
            }
            
            cancelInteractiveTransition()
            
        case .Cancelled:
            self.isInteractive = false
            cancelInteractiveTransition()
            
        default :
            break
