refactored stream injection