Reverted by 3d22dac6 because it depended on b9d079d6, which broke some tests.
mentioned in commit 3dbabead