Is your feature request related to a problem? Please describe.
The main function is hard to read, and it's not immediately clear what its for loops are doing.
Describe the solution you'd like
The function could use a more descriptive doctag. The content of the function should be split into helper functions with meaningful names. Remaining points of ambiguity can be clarified with comments.
Describe alternatives you've considered
We could leave everything as-is, which might make sense if we never expect to modify the main function. I expect that we'll need to modify the main function.
Additional context
Other functions could probably use cleanup too, but this one is particularly apparent.
Is your feature request related to a problem? Please describe.
The main function is hard to read, and it's not immediately clear what its for loops are doing.
Describe the solution you'd like
The function could use a more descriptive doctag. The content of the function should be split into helper functions with meaningful names. Remaining points of ambiguity can be clarified with comments.
Describe alternatives you've considered
We could leave everything as-is, which might make sense if we never expect to modify the main function. I expect that we'll need to modify the main function.
Additional context
Other functions could probably use cleanup too, but this one is particularly apparent.