Updated 4 to a generator function