Lots of class library tweaks