more stream refactoring