The first suggestion seems nicest (and the code is shorter too), but I *really* should have caught this myself since I used that pattern not long ago. The PR has been updated!