Massive code formatting cleanup

Still a few things to do though.