refactor for sp2 form generation