Lots of tweaks and fixes to view handling