convert iterables to generators to save memory