refactor: isolate stream functions