Refactor inotify