Gen rewritten with generators