 (require 'ht)
 (require 'ivy)
 
+(defvar danny-monitor-dir-path nil "Directory path to monitor.")
+
 (defvar danny--notify-descriptor nil "File notify descriptor.")
 
-(defvar danny-monitor-path nil "Path to monitor.")
-
-(defvar danny--history-hash (ht) "History.")
+(defvar danny--history-hash (ht) "History hashtable.")
 
 (defvar danny--destination-root "~/Downloads/Targets")
 

          lines)
    longest))

(defun danny--write-history-hashtable (path hashtable)
  "Write history HASHTABLE in PATH."
  (with-temp-buffer
    (prin1 hashtable (current-buffer))
    (write-file path nil)))

(defun danny--read-history-hashtable (path)
  "Read history hash in PATH."
  (if (not (f-exists? path))
      (ht-create)
    (with-temp-buffer
      (insert-file-contents path)
      (read (current-buffer)))))

(defun danny--last-destinations ()
  "Return a list of recent destinations."
  (ht-get danny--history-hash "last-destinations" '()))

(defun danny--add-destination-dir (dir)
  "Return a recent DIR to history.."
  (ht-set danny--history-hash
          "last-destinations"
          (-distinct (-concat (ht-get danny--history-hash
                                      "last-destinations" '()) (list dir))))
  (danny--write-history-hashtable danny--history-path danny--history-hash)
  danny--history-hash)


               (f-file-p file-path))
      (danny--handle-file-created file-path))))

(defun danny--create-move-action-fun (src-fpath)
  (lambda (dst-dpath)
    (let ((dst-fpath (f-join dst-dpath
                            (danny--read-string (format "Save as (%s): " (f-filename src-fpath))
                                                (f-filename src-fpath)
                                                20))))
      (when (equal src-fpath dst-fpath)
        (error "Moving to same location"))
      (if (f-exists-p dst-fpath)
          (progn
            (unless (danny--y-or-n (format "Override? %s\n" dst-fpath))
              (error "Aborted"))
            (rename-file src-fpath dst-fpath t)
            (danny--add-destination-dir dst-dpath))
        (rename-file src-fpath dst-fpath t)
        (danny--add-destination-dir dst-dpath)))))

(defun danny--create-open-action-fun (file-path)
  (lambda (ignored)
