Lots of fixes from CR