Some minor refactoring and tests for the Streams class.