refactoring the file watching service