Revert "Replace with new code"

This reverts commit 0103c7b016f22b3eb2c1f5357f067bccb081295a.