lib/streams: Refined stream hierarchy