   :host \"my\"
   :size [500 500]
   :setup setup
-  :update update
-  :draw draw
+  :update update-state
+  :draw draw-state
   :middleware [m/fun-mode])")
 
-(defn extract-size [sketch-source]
-  (letfn [(read-all [text]
-            (try
-              (let [reader (string-push-back-reader text)
-                    endof (gensym)]
-                (binding [reader/*read-eval* false
-                          reader/*data-readers* tags/*cljs-data-readers*]
-                  (->> #(reader/read reader false endof)
-                       (repeatedly)
-                       (take-while #(not= % endof))
-                       (doall))))
-              (catch Exception e
-                (println e)
-                '())))
-          (defsketch? [form]
+(defn parse-cljs
+  "Parses cljs source code using clojure.tools.reader and return vector
+  of parsed expressions."
+  [cljs-source]
+  (try
+    (let [reader (string-push-back-reader cljs-source)
+          endof (gensym)]
+      (binding [reader/*read-eval* false
+                reader/*data-readers* tags/*cljs-data-readers*]
+        (->> #(reader/read reader false endof)
+             (repeatedly)
+             (take-while #(not= % endof))
+             (doall)
+             vec)))
+    (catch Exception e
+      (println e)
+      [])))
+
+(defn extract-size [sketch]
+  (letfn [(defsketch? [form]
             (and (list? form)
                  (symbol? (first form))
                  (= "defsketch" (name (first form)))))

  {:color 0
   :angle 0})

(defn update [state]
  (let [{:keys [color angle]} state]
    {:color (mod (+ color 0.7) 255)
     :angle (mod (+ angle 0.1) q/TWO-PI)}))

(defn draw [state]
  (q/background 240)
  (q/fill (:color state) 255 255)
  (let [angle (:angle state)

(defn create-sketch [sketch]
  (try
    (let [source (:cljs sketch)
          parsed (parse-cljs source)
          js (compile-cljs parsed)
          size (extract-size parsed)
          id (str (swap! id inc))
          sketch (assoc sketch
                   :id id
