 ;;; Map of sockets used; useful for debug shutdown
 (defonce jup-sockets  (atom {}))
 
-(defn get-free-port! 
+(defn get-free-port!
   "Get a free port. Problem?: might be taken before I use it."
   []
   (let [socket (ServerSocket. 0)

  "Clojupyters nREPL handler."
  (apply nrepl-server/default-handler (map resolve clojupyter-middleware)))

(defn start-nrepl 
  "Start an nrepl server. Stop the existing one, if any (only possible when debugging)."
  []
  (when-let [server @the-nrepl]
    (nrepl-server/stop-server server))
  (reset! the-nrepl
          (nrepl-server/start-server 
           :port (get-free-port!)
           :handler clojupyer-nrepl-handler))
  (set-session!))

(ns ipython-clojure.core
  (:require
            [ipython-clojure.middleware.pprint]
            [ipython-clojure.middleware.stacktrace]
            [clojure.data.json :as json]
