We need a big docstring on top of this module explaining the strategy used by the restoring procedure, which is quite sophisticated.