   (Math/sqrt (+ (* (:x a) (:x a))
                 (* (:y a) (:y a)))))
 
+(defn zero-vector? [a]
+  (and (= 0 (:x a)) (= 0 (:y a))))
+
 ; returns the unit vector corresponding to vector a
 (defn v2-normalize [a]
-  (when (and (= 0 (:x a)) (= 0 (:y a)))
-    (.log js/console "Warning! Can't normalize zero vector"))
+  (when (zero-vector? a)
+    (throw "Can't normalize zero vector"))
   (let [mag (v2-mag a)]
     (Coord. (/ (:x a) mag)
             (/ (:y a) mag))))

  (+ (* (:x a) (:x b))
     (* (:y a) (:y b))))


(defn parameter-normalize [params]
  (let [last-t (last params)]

        (if (< max-error fit-error)
          [(adjust-bezier bezier coords params tan1 tan2
                          adjust-error max-adjust-iter)]
          (let [[left-tan right-tan] (v2-center-tangents
                                       (nth coords (dec split-point))
                                       (nth coords split-point)
                                       (nth coords (inc split-point)))]
            (vec (concat
                   (fit-cubic
                     (subvec coords 0 (inc split-point)) tan1 left-tan)
                   (fit-cubic
                      (subvec coords split-point) right-tan tan2)))))))))

(defn path-length [coords]
  (first (reduce
