Changing a bunch of stuff to clean up the code while I try to figure out why the odd case isn't working. It's still not working, but I'm pretty damn sure it's not on me. Famous last words (hint: it's probably my fault).
This code appears to be working. Don't ever touch it again. Debug is on still.
Debug is off.