Please do not attempt to simplify this code
I love this! It&#x27;s the &quot;jazz music&quot; of software development. Something which breaks all the &quot;rules&quot; but does so purposefully and explicitly so that it can become better than the &quot;rules&quot; allow.<p>A naive look at this and my head is screaming that this file is way too big, has way too many branches and nested if statements, has a lot of &quot;pointless comments&quot; that just describe what the line or few lines around it is doing, and has a lot of &quot;logic&quot; in the comments which could quickly become outdated or wrong compared to the actual code.<p>Yet at the same time, it&#x27;s probably a hell of a lot easier to maintain and manage than splitting the logic up among tens or hundreds of files, it contains a lot of the inherently complex work it&#x27;s doing to this file, and it is so well and heavily commented that it should be pretty easy to ensure that any changes also keep the comments up to date (after all, any change without changing the resulting comments should show up like a sore thumb, and will most likely prompt the reviewer to look into it at the very least).