                 return task.delay
             }()
 
-            if duration < d {
-                duration = d
+            if duration < _duration {
+                duration = _duration
             }
         }
 
         return duration
     }
 
-    var tasks: [Task] = [Task]()
+    var tasks = [Task]()
     var completion: () -> () = {}
     var running: Bool {
-        for task: Task in tasks {
+        for task in tasks {
             if !task.finished {
                 return true
             }

        before.start()
    }

    func _startPresent(context: UIViewControllerContextTransitioning) {
        let frame = context.finalFrameForViewController(context.viewControllerForKey(UITransitionContextToViewControllerKey)!)
        let fromView = context.viewForKey(UITransitionContextFromViewKey)!
        let toView = context.viewForKey(UITransitionContextToViewKey)!

        }

        let after = delay * Double(NSEC_PER_SEC)
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(after)), dispatch_get_main_queue()) {
            self._start()
        }
    }

    private func _start() {
        if let layer = layer, let animation = animation {
            layer.addAnimation(animation, forKey: animation.keyPath.hash.description)
            layer.setValue(animation.valueAfterAnimation, forKeyPath: animation.keyPath)
        } else {
            finish()
        }
