form template refactoring