connection streams refactoring