modified for stream2