This reverts commit c5f789050d and reapplies 7aea3ea8c3 with additional test changes.
c5f789050d
7aea3ea8c3