improved file watcher