Fixed a whole bunch of warnings. I wonder if I broke anything?