             operation.addCompletionBlock { [weak self, weak operation] in
                 guard let queue = self, let operation = operation else { return }
                 queue.delegate?.operationQueue?(queue, operationDidFinish: operation, withErrors: [])
-                queue.removeOpFromSet(operation)
+                operation.dependencies.forEach { operation.removeDependency($0) }
             }
         }
         

            }
        }
    }
    
    func addOpToSet(op: NSOperation) {
        dispatch_async(opsQueue) {
            self.ops.insert(op)
        }
    }
    
    func removeOpFromSet(op: NSOperation) {
        dispatch_async(opsQueue) {
            self.ops.remove(op)
        }
    }
}

    - Setting up dependencies to enforce mutual exclusivity
*/
public class OperationQueue: NSOperationQueue {
    public weak var delegate: OperationQueueDelegate?
    
    override public  func addOperation(operation: NSOperation) {
        if let op = operation as? Operation {
            
            // Set up a `BlockObserver` to invoke the `OperationQueueDelegate` method.
