added logging. changed completion check from size of directory to number
of cases.