So, first and foremost, great job.. I'd pay for it.
I've a feeling we'll go back and forth on this so I'll try and stay high level, especially since I don't have a strong understanding of the logic at play.
Watching the debug output, it seems like a lot of states could be saved, instead of...