Misc improvements and fixes.