Refactoring

Nested conditional untangle

Move the conditional as high as needed and just duplicate all the code for both branches. This lets you delete the nested conditionals that don't apply anymore to that branch. The code will now be in a flatter state and you can start making better abstraction decisions with it.

Remove concerns from scope as soon as possible

Early returns are good, they let us narrow the focus as the program continues. One less thing to juggle.

Lessons Learned

Don't use a migration temp state of code to be an excuse for writing bad code, it will make it harder, take longer, and increase the risk.