This reverts commit ac0fb593. It causes valgrind errors which I'll want to investigate before resubmitting this.