refactored stream