done my best to optimize file system watching