A bit of a hodge podge but this probably performs ok and to make the
testing robust requires a bit of replumbing which may change
performance. In other words, this is a place we can go back to if we
hit performance issues.