rewrite templates to generate more of the form, support array editing