Added stream optimizations.
Add performance improvements.