cleaned the stream API