Revert "Clean up applyState"

This reverts commit 5c5438abeea251e9250b2aceaa18115ab8899b8d.

Breaks core builds.