Lots of minor fixes.