Moved archive file scan to subroutine