added multithreading option for directory processing