refactoring some of the 'generate custom forms' functionality to be more flexible.