Revert ``prefix_structures`` to be a generator