test auto select with permissions
create stream only if necessary
refactoring