Several fixes in response to jdob's PR review.