Revert the revert and fix tests.