Streams refactoring