Factored out streamConstructor