Cleaned generation loop.