Fixed #180 (memory leak)

Fixed #180 by switching to a procedural implementation instead of
building up an entire promise chain of all the values yielded by the
generator.