Lots of little improvements and fixes.