Reworked recursive function call for groupRequired

groupRequired would do a recursive call, but the problem was that if
you modified the first field in the group, all subsequent fields in the
group would not get updated because the recursive call would only work
if the current field in context was not first. Revised the code by
inserting a temporary array of all the groupRequired fields into
options, iterating over the array, and then removing it from options
when done.

Also did a slight optimization of removing undefined array elements
from the rules.