This reverts commit f991c8c526. On second thought, this makes it unbearably slow and leaves far too much cruft behind.
f991c8c526