     - Setting up dependencies to enforce mutual exclusivity
 */
 public class OperationQueue: NSOperationQueue {
+    private let opsQueue = dispatch_queue_create("com.psoperations", DISPATCH_QUEUE_SERIAL)
     private var ops: Set<NSOperation> = Set()
+    
     public weak var delegate: OperationQueueDelegate?
     
     override public  func addOperation(operation: NSOperation) {
-        ops.insert(operation)
+        addOpToSet(operation)
         if let op = operation as? Operation {
             
             // Set up a `BlockObserver` to invoke the `OperationQueueDelegate` method.

            operation.addCompletionBlock { [weak self, weak operation] in
                guard let queue = self, let operation = operation else { return }
                queue.delegate?.operationQueue?(queue, operationDidFinish: operation, withErrors: [])
                queue.ops.remove(operation)
            }
        }
        

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