 
 (defvar sayid-trace-ns-dir nil)
 (defvar sayid-meta)
+
+(defvar sayid-buf-spec '("*sayid*" . sayid-mode))
 (defvar sayid-traced-buf-spec '("*sayid-traced*" . sayid-traced-mode))
-
+(defvar sayid-selected-buf sayid-buf-spec)
+
+(defvar sayid-ring)
+(setq sayid-ring '())
+
+(defun sayid-select-default-buf ()
+  (setq sayid-selected-buf sayid-buf-spec))
+
+(defun sayid-select-traced-buf ()
+    (setq sayid-selected-buf sayid-traced-buf-spec))
+
+(defun sayid-buf-point ()
+  (set-buffer (car sayid-selected-buf))
+  (point))
+
+(defun expanded-buffer-file-name ()
+  (expand-file-name (buffer-file-name)))
+(expanded-buffer-file-name)
 
 (defun sayid-get-trace-ns-dir ()
   (interactive)
   (or sayid-trace-ns-dir
       (let* ((default-dir (file-name-directory (buffer-file-name)))
-             (input (read-string "Scan dir for namespaces : "
-                                 default-dir)))
+             (input (read-directory-name "Scan dir for namespaces : "
+                                         default-dir)))
         (setq sayid-trace-ns-dir input)
         input)))
 
 (defun sayid-set-trace-ns-dir ()
   (interactive)
   (let* ((default-dir (file-name-directory (buffer-file-name)))
-         (input (read-string "Scan dir for namespaces : "
-                             (or sayid-trace-ns-dir
-                                 default-dir))))
+         (input (expand-file-name (read-directory-name "Scan dir for namespaces : "
+                                                       (or sayid-trace-ns-dir
+                                                           default-dir)))))
     (setq sayid-trace-ns-dir input)
     input))
 
-(defun sayid-init-buf (&optional buf-name)
-  (let ((buf-name- (or buf-name "*sayid*")))
+(defun sayid-init-buf ()
+  (let ((buf-name- (car sayid-selected-buf)))
     (pop-to-buffer buf-name-)
+    (update-buf-pos-to-ring)
     (read-only-mode 0)
     (erase-buffer)
     (get-buffer buf-name-)))

    'sayid-replay-workspace-query-point)
  (define-key clojure-mode-map (kbd "C-c s w") 'sayid-get-workspace)
  (define-key clojure-mode-map (kbd "C-c s t y") 'sayid-trace-all-ns-in-dir)
  (define-key clojure-mode-map (kbd "C-c s t a") 'sayid-trace-ns)   ;;TODO
  (define-key clojure-mode-map (kbd "C-c s t e") 'sayid-trace-fn-enable)   ;;TODO
  (define-key clojure-mode-map (kbd "C-c s t E") 'sayid-trace-ns-enable)   ;;TODO
  (define-key clojure-mode-map (kbd "C-c s t d") 'sayid-trace-fn-disable)   ;;TODO
  (define-key clojure-mode-map (kbd "C-c s t D") 'sayid-trace-ns-disable)   ;;TODO
  (define-key clojure-mode-map (kbd "C-c s t n") 'sayid-inner-trace-fn)   ;;TODO
  (define-key clojure-mode-map (kbd "C-c s t o") 'sayid-outer-trace-fn)   ;;TODO
  (define-key clojure-mode-map (kbd "C-c s k") 'sayid-kill-all-traces)
  (define-key clojure-mode-map (kbd "C-c s c") 'sayid-clear-log)
  (define-key clojure-mode-map (kbd "C-c s x") 'sayid-reset-workspace)
  (define-key clojure-mode-map (kbd "C-c s s") 'sayid-show-traced)

      (read v)
    v))

(defun list-take (n l)
  (butlast l (- (length l) n)))

(defun push-to-ring (v)
  (setq sayid-ring (list-take 5 (cons v sayid-ring))))

(defun peek-first-in-ring ()
  (first sayid-ring))

(defun swap-first-in-ring (v)
  (setq sayid-ring (cons v (cdr sayid-ring))))

(defun cycle-ring ()
  (setq sayid-ring
