Implement state restoration