Prepared the code for scanning the directory