   {
     let deferred = Deferred<U>()
     self.notify(queue) {
-      (result: T) -> Void in
+      value in
       deferred.setState(.Running)
-      task(result).notify(queue) { deferred.value = $0 }
+      transform(value).notify(queue) { transformedValue in deferred.setValue(transformedValue) }
     }
     return deferred
   }

    }
  }
  
  private func setValue(result: T, trapOnFailure: Bool = true)
  { // A very simple turnstile to ensure only one thread can succeed
    if setState(.Assigning)
    {
      v = result
      guard setState(.Completed) else { fatalError("Could not complete assignment of result in \(__FUNCTION__)") }
      // The result is now available for the world
    }
    else if trapOnFailure { fatalError("Probable attempt at setting a Deferred value twice with \(__FUNCTION__)") }
  }

  // MARK: public interface


    guard setState(.Running) else { fatalError("Could not start task in \(__FUNCTION__)") }
    dispatch_async(queue) {
      self.setValue(task())
    }
  }

