Implement config file system watcher and refactor a bit