simplify generater code