refine the generator