     (println (str "lon:     " lon))
     (println (str "Vendor:  " vendor-name))
     (println (str "Deal:    " vendor-deal))
+    (println  (heading-distance {:lat start-lat :lon start-lon}
+                                {:lat lat :lon lon}))
     (println)))
 
 
-(defn show-all-deals[]
+(defn show-all-deals[start-lat start-lon]
   (let [results (d/q '[:find ?e :where [?e :location/geocode]] (d/db conn))]
     (doseq[r results]
-      (print-entity r))))
+      (print-entity start-lat start-lon r))))
 
 
-(show-all-deals)
+(show-all-deals 53.99134711 -6.40017986)
 
 (defn get-nearest-deals
   "Get deals within a certain radius"

    (println end)
    (println (count res))
    (doseq[r res]
      (print-entity r))))

;(get-nearest-deals 53.98193516 -6.41601562 8)
(get-nearest-deals 53.99134711 -6.39824867 6)


(save-deal 53.98193516 -6.41601562 "Dundalk shop" "Free coffee")

;; Calculate heading and distance given two GPS co-ordinates
(defn heading-distance[gps-start gps-end]
  (let [lat-start (:lat gps-start)
        lon-start (:lon gps-start)
        lat-end (:lat gps-end)
        lon-end (:lon gps-end)
        NS (if (< lat-start lat-end) :north :south)
        EW (if (< lon-start lon-end) :east :west)
        ]
    (vector NS EW (gps/haversine gps-start gps-end))))

(heading-distance {:lat 56.99134711 :lon -6.40017986}
                  {:lat 54.99031266 :lon -4.40017986})



(defn print-entity[start-lat start-lon entity]
  (let [location-ent (d/entity (d/db conn) (first entity))
        vendor-ent (first (:location/vendor location-ent))
        geocode (:location/geocode location-ent)
