Fixed bugs, and tweaks a bunch of stuff.