Rework the interpreter stream management

Merged username-removed-1136591 requested to merge rework-stream-interface into master