Revert "Revert "Clean up old code""

This reverts commit 15af46fb1a400891696422f7880d187d9d29cb10.