Refactoring and Logic Cleanup

This is a giant set of commits that takes the latest code in master and cleans it up to have a more understandable execution flow and remove some bugs I've noticed.

I **hate** doing large merges, but as always with these cleanups, I can't avoid it.