refactoring around stream open process