Removed inefficient usage of streams