Reorganized NFA generation for lists to be more readable.