Add spec.
Refactor code (`restore` stdout modified)