Pull state into a #state{}. Introduce sync().