start refactor to increase stream performance