Revert "Merge branch 'legacy' into old-state"

This reverts commit 4be9ffc8fc77277a2226fed80f81cd9b763a8206, reversing
changes made to 37219ff789fd864ff222d783db5da4b860b26143.