Switch to state-based structure