Added a global variable to count the number of files visited