A lot of small fixes and tweaks.