Tidy up of archive logic and corresponding test.