[Do not merge] Major cleanup

Rewriting a bunch of stuff since the brain is quickly degrading.