This refactor supports a patch I was reviewing [1]. I thought it
better to apply this consistently in this file as a separate refactor
so that that patch could be done cleaner.
[1] https://review.openstack.org/#/c/100963
Change-Id: Ida58758504e868dc731e97d7bce53d4849998723