Simplifying state capture and restoration