Added test_restore
Changed os.path usages to pathlib, fixed some corner cases that these changes unearthed