Stream examples and some refactoring