refactor streams