All state change logic in one place.