Improve idioms in a few places.