Refactor a form