Refactor -- move most code out into form.mc