improved gen example