_gen optimization stage 1