refactored archive and wrote test