Fix a bunch of stuff. Probably breaks more.