 (defn on-search
   "Packet handler for :search"
   [ch packet]
-  ; TODO implement
   (if-let [system (:system packet)]
-    ; NB this seems overly complicated
+    ; NB this also seems overly complicated
     (apply search-stations
            (flatten (conj [system] 
                           (calculate-packet-to-seq packet)
-                          :callback #(to-client ch %))))
+                          :callback #(to-client ch {:type :search-result
+                                                    :result %}))))
     (client-error ch "Must specify system")))
 
 ;;

            (.contains station-name input)
            (.contains system-name input))))
      (get-stations))))

;;
;; API calls

  "http://www.elitetradingtool.co.uk/api/EliteTradingTool/Calculator")
(def search-url 
  "http://www.elitetradingtool.co.uk/api/EliteTradingTool/Search")
;; mapping for search-stations :search-type arg value to API value
(def search-types {:buying "Station Buying"
                   :selling "Station Selling"})
;;
;; Util methods
;;
