 }
 
 extension Deferred {
+    /**
+    Composes the recieving value with another.
+
+    :param: other Any other deferred value.
+
+    :returns: A value that becomes determined after both the reciever and the
+    given values become determined.
+    */
     public func both<OtherValue>(other: Deferred<OtherValue>) -> Deferred<(Value, OtherValue)> {
         return flatMap { t in other.map { u in (t, u) } }
     }
 }
 
+/**
+Compose a number of deferred values into a single deferred array.
+
+:param: deferreds Any collection whose elements are themselves deferred values.
+:return: A deferred array that is determined once all the given values are
+determined, in the same order.
+**/
 public func all<Value, Collection: CollectionType where Collection.Generator.Element == Deferred<Value>>(deferreds: Collection) -> Deferred<[Value]> {
     let array = Array(deferreds)
     if array.isEmpty {

    return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
}

public struct Deferred<Value> {
    typealias UponBlock = (dispatch_queue_t, Value -> ())
    private typealias Protected = (protected: Value?, uponBlocks: [UponBlock])

    private var protected: LockProtected<Protected>

    private init(_ value: Value?) {
        protected = LockProtected(item: (value, []))
    }

    // Initialize an unfilled Deferred
    public init() {
        self.init(nil)
    }

    // Initialize a filled Deferred with the given value
    public init(value: Value) {
        self.init(value)
    }

    // Check whether or not the receiver is filled
    public var isFilled: Bool {
        return protected.withReadLock { $0.protected != nil }
    }
    
    public func fill(value: Value, assertIfFilled: Bool = true, file: StaticString = __FILE__, line: UWord = __LINE__) {
        let (filledValue, blocks) = protected.withWriteLock { data -> (Value, [UponBlock]) in
            if assertIfFilled {

}

extension Deferred {
    /**
    Begins another asynchronous operation with the deferred value once it
    becomes determined.

    :param: queue A dispatch queue for starting the new operation on.
    :param: transform A function to start a new deferred given the recieving
    value.

    :returns: A new deferred value that is determined once the recieving
    deferred is determined by beginning some new operation using that value.
    **/
    public func flatMap<NewValue>(upon queue: dispatch_queue_t = DeferredDefaultQueue, transform: Value -> Deferred<NewValue>) -> Deferred<NewValue> {
        let d = Deferred<NewValue>()
        upon(queue) {
