Per the commit comment, this is a first cut at rationalizing the code - prior to attempting to fix the code one has to intuit what the author intended.