modified archive function