Theres a bunch of shitty logic all over the place, that I can only presume was never actively tested outside of "ok it compiles, SHIP IT."