        n
        (recur tail distance (+ k head) (inc n)))))
 
-(defn target-coordinates [src dst meters-away]
-  (let [coordinates (reverse (decode-polyline (polyline src dst)))
+(defn format-intx [intx extender]
+  (str "Intersection of "
+       (clojure.string/join " and " (:intersection/of intx))
+       "," extender))
+
+(defn target-coordinates [src dst gap extender]
+  (let [formatted-src (format-intx src extender)
+        formatted-dst (format-intx dst extender)
+        coordinates (reverse (decode-polyline (polyline formatted-src formatted-dst)))
         pairs (partition 2 1 coordinates)
         segments (map (fn [[a b]] (haversine a b)) pairs)
-        back-segment (take-segments segments meters-away)
+        back-segment (take-segments segments gap)
         front-segment (dec back-segment)
+        back-distance (reduce + (take back-segment segments)) 
         front-distance (reduce + (take front-segment segments))
         back-coordinate (nth coordinates back-segment)   
         front-coordinate (nth coordinates front-segment)
-        front-to-target (- meters-away front-distance)]
-    (interpolate-coordinates front-coordinate back-coordinate front-to-target meters-away)))
+        front-to-back (- back-distance front-distance)
+        front-to-target (- gap front-distance)]
+    (interpolate-coordinates front-coordinate back-coordinate front-to-back front-to-target)))
 
 (defroutes routes
   (POST "/rush-hour/api/triangulate/edn" {:keys [body]}
-        (let [{:keys [src dst]} (read-string (slurp body))]
-          (pr-str {:coordinates (interpolate-coordinates)}))))
+        (let [{:keys [src dst gap extender]} (read-string (slurp body))]
+          (pr-str {:coordinates (target-coordinates src dst gap extender)}))))
 
 (def app (wrap-params #'routes))
 

        lat-diff (- lat2 lat1)
        lon-diff (- lon2 lon1)
        theta (Math/atan (/ lon-diff lat-diff))
        x1 (* (Math/cos theta) d)
        y1 (* (Math/sin theta) d)
        x2 (* (Math/cos theta) c)
        y2 (* (Math/sin theta) c)
        x-ratio (* (/ x1 x2) lat-diff)
        y-ratio (* (/ y1 y2) lon-diff)]
    {:lat (+ lat1 x-ratio) :long (+ lon1 y-ratio)}))

                (Math/cos lat1) (Math/cos lat2)))]
    (* radius-of-earth 2 (Math/asin (Math/sqrt a)))))

(defn interpolate-coordinates [a b whole piece]
  (let [lat1 (:lat a)
        lon1 (:long a)
        lat2 (:lat b)
