Improve naming from formElement to main form and store array length in a variable