as discussed i think we should move `generate_template`