lots of little fixes and tweaks.