   (let [element (-> d3 (.select selector) .node)
         width (.-clientWidth element)
         height (.-clientHeight element)
-        svg (setup-svg! selector width height)
-        state (initial-state svg width height)]
-    (setup-graph! state)))
+        svg (setup-svg! selector width height)]
+    (load-nodes "miserables.json"
+                (fn [nodes]
+                  (let [state (initial-state svg width height nodes)]
+                    (setup-graph! state))))))

        (.attr "class" "node")
        (.attr "cx" #(:x %))
        (.attr "cy" #(:y %))
        (.attr "r" 32))))

;; State management

(defn initial-state [svg width height]
  {:svg svg
   :view-width width
   :view-height height
   :camera-x 0
   :camera-y 0
   :nodes [{:x 40 :y 40}]})

;; Exported function to do magic


;; (defonce conn
;;   (repl/connect "http://localhost:9000/repl"))

;; Debug

(enable-console-print!)

(defn p [message f & args]
  (let [ret (apply f args)]
    (println message (apply f args))
    ret))

(def d3 js/d3)

;; Constants

(def world-width 1280)
(def world-height 800)

;; SVG setup

