cleanup in per-state model generation code