A giant pile of mostly small cleanup

Hopefully the commit messages can explain what each of them do