Refactoring some code in the form builder.