converting streams to new template system in stream.h