I think all of this code will benefit from a separate cleanup PR.
Also: the live tests have been very fragile for me, so they should be ... refactored.
I don't want to modify this because it already got merged, and will probably have to be fixed in master first and then backported (which is why separate PR).