some more refactoring regarding streams