REP-1120

This was so close to what @dmnjohns was doing that it only took a couple of actual tweaks to finish it up. The bulk of the time and effort was in figuring out how to test it.