Added code to monitor files from threads