JoinStream refactoring and optimizations.
Refactoring and optimizations of SortJoinStream.