 (defonce untitled-applet-id* (atom 0))
 (def ^:dynamic *applet* nil)
 (def ^:dynamic *graphics* nil)
+
+(defn- no-fn
+  "Function that does nothing."
+  [])
 
 (defn ^PApplet current-applet []
   *applet*)

        target            (validate-target! (:target options))
        title             (or (:title options) (str "Quil " (swap! untitled-applet-id* inc)))
        renderer          (or (:renderer options) :java2d)
        draw-fn           (or (:draw options) (fn [] nil))
        output-file       (validate-output-file! renderer (:output-file options))
        target            (if (empty? output-file) target :none)
        setup-fn          (fn []
                            (when-let [wheel-listener (wrap-mouse-wheel (:mouse-wheel options)
                                                                        (current-applet))]
                              (.addMouseWheelListener (current-applet) wheel-listener))
                            (when-let [f (:setup options)]
                              (f)))
        safe-draw-fn      (fn []
                            (try
                              (draw-fn)

                                (println "Exception in Quil draw-fn for sketch" title ": " e "\nstacktrace: " (with-out-str (print-cause-trace e)))
                                (Thread/sleep 1000))))
        draw-fn           (if (:safe-draw-fn options) safe-draw-fn draw-fn)
        on-close-fn       (or (:on-close options) no-fn)
        state             (atom nil)
        target-obj        (atom nil)
        looping?          (atom true)
        listeners         (into {} (for [name listeners]
                                     [name (or (options name) no-fn)]))
        applet-state      (merge options
                                 {:state state
                                  :target-obj target-obj
