 extension SignalChannel {
 	
 	public func timeInterval(context: Exec = .direct) -> SignalChannel<I, Double> {
-		return nextStage { $0.timeInterval(context: context) }
+		return next { $0.timeInterval(context: context) }
 	}
 	
 	public func timeout(interval: DispatchTimeInterval, resetOnValue: Bool = true, context: Exec = .direct) -> SignalChannel<I, T> {
-		return nextStage { $0.timeout(interval: interval, resetOnValue: resetOnValue, context: context) }
+		return next { $0.timeout(interval: interval, resetOnValue: resetOnValue, context: context) }
 		}
 	
 	public func timestamp(context: Exec = .direct) -> SignalChannel<I, (T, DispatchTime)> {
-		return nextStage { $0.timestamp(context: context) }
+		return next { $0.timestamp(context: context) }
 		}
 }
 

	}
	
	public func cancellableJoin(to: SignalMergeSet<T>, closePropagation: SignalClosePropagation = .none, removeOnDeactivate: Bool = false) throws -> (I, Cancellable) {
		return try (input, signal.cancellableJoin(to: to, closePropagation: closePropagation, removeOnDeactivate: removeOnDeactivate))
	}
		
	public func join(to: SignalMultiInput<T>) -> I {
		signal.join(to: to)
		return input
	}
	
	public func cancellableJoin(to: SignalMultiInput<T>) -> (I, Cancellable) {
		return (input, signal.cancellableJoin(to: to))
	}
	
	public func pollingEndpoint() -> (I, SignalPollableEndpoint<T>) {
		return (input, SignalPollableEndpoint(signal: signal))
	}
}

// Implementation of SignalReactive.swift
extension SignalChannel {
	public func buffer<U>(boundaries: Signal<U>) -> SignalChannel<I, [T]> {
		return nextStage { $0.buffer(boundaries: boundaries) }
	}
	
	public func buffer<U>(windows: Signal<Signal<U>>) -> SignalChannel<I, [T]> {
		return nextStage { $0.buffer(windows: windows) }
		}
	
	public func buffer(count: UInt, skip: UInt) -> SignalChannel<I, [T]> {
		return nextStage { $0.buffer(count: count, skip: skip) }
		}
	
	public func buffer(interval: DispatchTimeInterval, count: Int = Int.max, continuous: Bool = true, context: Exec = .direct) -> SignalChannel<I, [T]> {
		return nextStage { $0.buffer(interval: interval, count: count, continuous: continuous, context: context) }
		}
	
	public func buffer(count: UInt) -> SignalChannel<I, [T]> {
		return nextStage { $0.buffer(count: count, skip: count) }
		}
	
	public func buffer(interval: DispatchTimeInterval, timeshift: DispatchTimeInterval, context: Exec = .direct) -> SignalChannel<I, [T]> {
		return nextStage { $0.buffer(interval: interval, timeshift: timeshift, context: context) }
		}
	
	public func filterMap<U>(context: Exec = .direct, _ processor: @escaping (T) -> U?) -> SignalChannel<I, U> {
		return nextStage { $0.filterMap(context: context, processor) }
		}
	
	public func filterMap<S, U>(initialState: S, context: Exec = .direct, _ processor: @escaping (inout S, T) -> U?) -> SignalChannel<I, U> {
		return nextStage { $0.filterMap(initialState: initialState, context: context, processor) }
		}
	
	public func failableMap<U>(context: Exec = .direct, _ processor: @escaping (T) throws -> U) -> SignalChannel<I, U> {
		return nextStage { $0.failableMap(context: context, processor) }
		}
	
	public func failableMap<S, U>(initialState: S, context: Exec = .direct, _ processor: @escaping (inout S, T) throws -> U) -> SignalChannel<I, U> {
		return nextStage { $0.failableMap(initialState: initialState, context: context, processor) }
		}
	
	public func failableFilterMap<U>(context: Exec = .direct, _ processor: @escaping (T) throws -> U?) -> SignalChannel<I, U> {
		return nextStage { $0.failableFilterMap(context: context, processor) }
		}
	
	public func failableFilterMap<S, U>(initialState: S, context: Exec = .direct, _ processor: @escaping (inout S, T) -> U?) throws -> SignalChannel<I, U> {
		return nextStage { $0.failableFilterMap(initialState: initialState, context: context, processor) }
		}
	
	public func flatMap<U>(context: Exec = .direct, _ processor: @escaping (T) -> Signal<U>) -> SignalChannel<I, U> {
		return nextStage { $0.flatMap(context: context, processor) }
		}
	
	public func flatMapFirst<U>(context: Exec = .direct, _ processor: @escaping (T) -> Signal<U>) -> SignalChannel<I, U> {
		return nextStage { $0.flatMapFirst(context: context, processor) }
		}
	
	public func flatMapLatest<U>(context: Exec = .direct, _ processor: @escaping (T) -> Signal<U>) -> SignalChannel<I, U> {
		return nextStage { $0.flatMapLatest(context: context, processor) }
		}
	
	public func flatMap<U, V>(initialState: V, context: Exec = .direct, _ processor: @escaping (inout V, T) -> Signal<U>) -> SignalChannel<I, U> {
		return nextStage { $0.flatMap(initialState: initialState, context: context, processor) }
		}
	
	public func concatMap<U>(context: Exec = .direct, _ processor: @escaping (T) -> Signal<U>) -> SignalChannel<I, U> {
		return nextStage { $0.concatMap(context: context, processor) }
		}
	
	public func groupBy<U: Hashable>(context: Exec = .direct, _ processor: @escaping (T) -> U) -> SignalChannel<I, (U, Signal<T>)> {
		return nextStage { $0.groupBy(context: context, processor) }
		}
	
	public func map<U>(context: Exec = .direct, _ processor: @escaping (T) -> U) -> SignalChannel<I, U> {
		return nextStage { $0.map(context: context, processor) }
		}
	
	public func map<U, V>(initialState: V, context: Exec = .direct, _ processor: @escaping (inout V, T) -> U) -> SignalChannel<I, U> {
		return nextStage { $0.map(initialState: initialState, context: context, processor) }
		}
	
	public func scan<U>(initialState: U, context: Exec = .direct, _ processor: @escaping (U, T) -> U) -> SignalChannel<I, U> {
		return nextStage { $0.scan(initialState: initialState, context: context, processor) }
		}
	
	public func window<U>(boundaries: Signal<U>) -> SignalChannel<I, Signal<T>> {
		return nextStage { $0.window(boundaries: boundaries) }
		}
	
	public func window<U>(windows: Signal<Signal<U>>) -> SignalChannel<I, Signal<T>> {
		return nextStage { $0.window(windows: windows) }
		}
	
	public func window(count: UInt, skip: UInt) -> SignalChannel<I, Signal<T>> {
		return nextStage { $0.window(count: count, skip: skip) }
		}
	
	public func window(interval: DispatchTimeInterval, count: Int = Int.max, continuous: Bool = true, context: Exec = .direct) -> SignalChannel<I, Signal<T>> {
		return nextStage { $0.window(interval: interval, count: count, continuous: continuous, context: context) }
		}
	
	public func window(count: UInt) -> SignalChannel<I, Signal<T>> {
		return nextStage { $0.window(count: count, skip: count) }
		}
	
	public func window(interval: DispatchTimeInterval, timeshift: DispatchTimeInterval, context: Exec = .direct) -> SignalChannel<I, Signal<T>> {
		return nextStage { $0.window(interval: interval, timeshift: timeshift, context: context) }
		}
	
	public func debounce(interval: DispatchTimeInterval, flushOnClose: Bool = true, context: Exec = .direct) -> SignalChannel<I, T> {
		return nextStage { $0.debounce(interval: interval, flushOnClose: flushOnClose, context: context) }
		}
	
	public func throttleFirst(interval: DispatchTimeInterval, context: Exec = .direct) -> SignalChannel<I, T> {
		return nextStage { $0.throttleFirst(interval: interval, context: context) }
		}
}

extension SignalChannel where T: Hashable {
	public func distinct() -> SignalChannel<I, T> {
		return nextStage { $0.distinct() }
	}
	
	public func distinctUntilChanged() -> SignalChannel<I, T> {
		return nextStage { $0.distinctUntilChanged() }
		}
}

extension SignalChannel {
	public func distinctUntilChanged(context: Exec = .direct, comparator: @escaping (T, T) -> Bool) -> SignalChannel<I, T> {
		return nextStage { $0.distinctUntilChanged(context: context, comparator: comparator) }
	}
	
	public func elementAt(_ index: UInt) -> SignalChannel<I, T> {
		return nextStage { $0.elementAt(index) }
		}
	
	public func filter(context: Exec = .direct, matching: @escaping (T) -> Bool) -> SignalChannel<I, T> {
		return nextStage { $0.filter(context: context, matching: matching) }
		}
	
	public func ofType<U>(_ type: U.Type) -> SignalChannel<I, U> {
		return nextStage { $0.ofType(type) }
		}
	
	public func first(context: Exec = .direct, matching: @escaping (T) -> Bool = { _ in true }) -> SignalChannel<I, T> {
		return nextStage { $0.first(context: context, matching: matching) }
		}
	
	public func single(context: Exec = .direct, matching: @escaping (T) -> Bool = { _ in true }) -> SignalChannel<I, T> {
		return nextStage { $0.single(context: context, matching: matching) }
		}
	
	public func ignoreElements() -> SignalChannel<I, T> {
		return nextStage { $0.ignoreElements() }
		}
	
	public func ignoreElements<S: Sequence>(endWith: @escaping (Error) -> (S, Error)?) -> SignalChannel<I, S.Iterator.Element> {
		return nextStage { $0.ignoreElements(endWith: endWith) }
		}
	
	public func last(context: Exec = .direct, matching: @escaping (T) -> Bool = { _ in true }) -> SignalChannel<I, T> {
		return nextStage { $0.last(context: context, matching: matching) }
		}
	
	public func sample(_ trigger: Signal<()>) -> SignalChannel<I, T> {
		return nextStage { $0.sample(trigger) }
		}
	
	public func sampleCombine<U>(_ trigger: Signal<U>) -> SignalChannel<I, (T, U)> {
		return nextStage { $0.sampleCombine(trigger) }
		}
	
	public func skip(_ count: Int) -> SignalChannel<I, T> {
		return nextStage { $0.skip(count) }
		}
	
	public func skipLast(_ count: Int) -> SignalChannel<I, T> {
		return nextStage { $0.skipLast(count) }
		}
	
	public func take(_ count: Int) -> SignalChannel<I, T> {
		return nextStage { $0.take(count) }
		}
	
	public func takeLast(_ count: Int) -> SignalChannel<I, T> {
		return nextStage { $0.takeLast(count) }
		}
}


	}
}

