fix stream / refactoring