Feedback from code review, plus more test fixes