Improved stream's performance by caching results.