Templatize on type of stream