adjusted the stream enqueue algorithm to be more efficient
tests to conform with adjustments to stream enqueue algorithm