 /// on the returned signal.
 public func takeLast<T,E>(count: Int)(signal: Signal<T,E>) -> Signal<T,E> {
 	return Signal { observer in
-		let buffer = Atomic<[T]>({
-			var bufferArray = [T]()
-			bufferArray.reserveCapacity(count)
-			return bufferArray
-		}())
-		
+		var buffer = [T]()
+		buffer.reserveCapacity(count)
+
 		return signal.observe(next: { value in
-			buffer.modify { oldBuffer in
-				var newBuffer = oldBuffer
-				newBuffer.append(value)
-				
-				while newBuffer.count > count {
-					newBuffer.removeAtIndex(0)
-				}
-				return newBuffer
-			}
-			return
+			buffer.append(value)
+
+			while buffer.count > count {
+				buffer.removeAtIndex(0)
+			}
 		}, error: { error in
 			sendError(observer, error)
 		}, completed: {
-			for bufferedValue in buffer.value {
+			for bufferedValue in buffer {
 				sendNext(observer, bufferedValue)
 			}
 			

/// at which point the returned signal behaves exactly like `signal`.
public func skipWhile<T, E>(predicate: T -> Bool)(signal: Signal<T, E>) -> Signal<T, E> {
	return Signal { observer in
		let isSkipping = Atomic(true)
		return signal.observe(next: { value in
			isSkipping.modify { wasSkipping in
				var shouldSkip = wasSkipping && predicate(value)
				if !shouldSkip {
					sendNext(observer, value)
				}
				return shouldSkip
			}
			return
		}, error: { error in
			sendError(observer, error)
		}, completed: {

/// first argument when the next value is emitted, and so on.
public func scan<T, U, E>(initial: U, combine: (U, T) -> U)(signal: Signal<T, E>) -> Signal<U, E> {
	return Signal { observer in
		var accumulator = initial
		return signal.observe(Signal.Observer { event in
			observer.put(event.map { value in
				accumulator = combine(accumulator, value)
				return accumulator
			})
		})
	}
}
