     /// thread. You should start an asynchronous task and call either `fulfill`
     /// or `reject` when it completes.
     public init(_ closure: (_ fulfill: @escaping (T) -> Void, _ reject: @escaping (Error) -> Void) -> Void) {
-        handlers = Handlers<T>()
+        handlers = Handlers()
         closure({ self._fulfill($0) }, { self._reject($0) }) // retain self
     }
     
     private func _fulfill(_ value: T) {
-        _resolve(.fulfilled(value))?.fulfill.forEach { $0(value) }
+        let handlers = _transitionToState(.fulfilled(value))
+        handlers?.fulfill.forEach { $0(value) }
     }
 
     private func _reject(_ error: Error) {
-        _resolve(.rejected(error))?.reject.forEach { $0(error) }
+        let handlers = _transitionToState(.rejected(error))
+        handlers?.reject.forEach { $0(error) }
     }
 
     // Return handlers to call if promise was resolved. Returns nil otherwise.
-    private func _resolve(_ result: Result<T>) -> Handlers<T>? {
-        _lock.lock(); defer { _lock.unlock() }
-        guard self.result == nil else { return nil } // already resolved
-        self.result = result
+    private func _transitionToState(_ state: State) -> Handlers? {
+        lock.lock(); defer { lock.unlock() }
+        guard case .pending = self.state else {
+            return nil // already resolved
+        }
+        self.state = state
         let handlers = self.handlers
         self.handlers = nil
         return handlers // returns handlers to be used outside of critical section
     }
 
     /// Creates a promise fulfilled with a given value.
-    public init(value: T) { result = .fulfilled(value) }
+    public init(value: T) {
+        state = .fulfilled(value)
+    }
 
     /// Creates a promise rejected with a given error.
-    public init(error: Error) { result = .rejected(error) }
+    public init(error: Error) {
+        state = .rejected(error)
+    }
 
     // MARK: Callbacks
     

/// Promises start in a *pending* state and either get *fulfilled* with a
/// value or get *rejected* with an error.
public final class Promise<T> {
    private var handlers: Handlers<T>? // nil when finished
    private var result: Result<T>? // nil when pending

    // MARK: Creation


        let _fulfill: (T) -> Void = { value in queue.async { fulfill(value) } }
        let _reject: (Error) -> Void = { error in queue.async { reject(error) } }

        let state = _register(fulfill: _fulfill, reject: _reject)

        // already resolved
        switch state {
        case .pending: break // obsevers registered
        case let .fulfilled(value): _fulfill(value)
        case let .rejected(error): _reject(error)
        }
    }

    /// Registers observers if pending. Returns state at the time or registration.
    private func _register(fulfill: @escaping (T) -> Void, reject: @escaping (Error) -> Void) -> State {
        lock.lock(); defer { lock.unlock() }
        handlers?.fulfill.append(fulfill)
        handlers?.reject.append(reject)
        return state
    }

    // MARK: Then
