Lots of tweaks to improve tests