solution to STREAMS