code review suggestions

I've done a Zach-style code review, one commit per suggestion.