use a generator instead of a list