This (and its usage, below) was easier than making the logic more complicated, but probably size-suboptimal.