fixes a bunch of bugs and stuff.  improves logging quite a bit.