refactor archive creation code
refactor archive creation