Fixed a bunch of stuff, including logging