Revert "Delete a bunch of dead code."

This reverts commit 83c8c1dc02c3bf8beb0b15bcc6a0357e94677deb.