 }
 
 extension Deferred {
-    public var value: T {
+    public var value: Value {
         // fast path - return if already filled
         if let v = peek() {
             return v

        return d
    }

    public func map<U>(upon queue: dispatch_queue_t = DeferredDefaultQueue, transform: T -> U) -> Deferred<U> {
        return flatMap(upon: queue) { t in Deferred<U>(value: transform(t)) }
    }
}

extension Deferred {
    public func both<U>(other: Deferred<U>) -> Deferred<(T,U)> {
        return self.flatMap { t in other.map { u in (t, u) } }
    }
}

    }

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

    // Check whether or not the receiver is filled
    public var isFilled: Bool {
        return protected.withReadLock { $0.protected != nil }
    }

    private func _fill(value: Value, assertIfFilled: Bool) {
        let (filledValue, blocks) = protected.withWriteLock { data -> (Value, [UponBlock]) in
            if assertIfFilled {
                precondition(data.protected == nil, "Cannot fill an already-filled Deferred")
                data.protected = value
            } else if data.protected == nil {
                data.protected = value
            }
            let blocks = data.uponBlocks
            data.uponBlocks.removeAll(keepCapacity: false)
            return (data.protected!, blocks)
        }
        for (queue, block) in blocks {
            dispatch_async(queue) { block(filledValue) }
        }
    }

    public func fill(value: Value) {
        _fill(value, assertIfFilled: true)
    }

    public func fillIfUnfilled(value: Value) {
        _fill(value, assertIfFilled: false)
    }

    public func peek() -> Value? {
        return protected.withReadLock { $0.protected }
    }

    public func upon(_ queue: dispatch_queue_t = DeferredDefaultQueue, function: Value -> ()) {
        let maybeValue: Value? = protected.withWriteLock{ data in
            if data.protected == nil {
                data.uponBlocks.append( (queue, function) )
            }
            return data.protected
        }
        if let value = maybeValue {
            dispatch_async(queue) { function(value) }
