Refactoring; adding a poll fallback for inotify.