 (defn -main
   "I don't do a whole lot ... yet."
   [& args]
-  (let [output-type (nth args 0)
+  (let [data-type (nth args 0)
         envelope (nth args 1)]
-   (println (json/write-str (parse output-type envelope)))))
+   (println (json/write-str (parse data-type envelope)))))

;; Util
;; ---

(defmulti output-type-handler 
  (fn [o-type] o-type))

(defmethod output-type-handler "json" [_]
  [{} #(assoc %1 %2 %3)])

(defmethod output-type-handler "csv" [_]
  [[] #(conj %1 %3)])

(defmethod output-type-handler :default [_]
  (output-type-handler "csv"))

;; ---
;; Core
;; ---

;; TODO: Sleep, wake up, clean up organization

(defn valid-envelope? [envelope cksum]
  (= (ais-util/checksum envelope) cksum))

(defn payload->binary [msg]
  (->> (seq msg)

	         (collector a (tag-map :tag) nil))))                 ; null value, pass thru
      a)))
    
(defn parse [data-type line]
  (let [[acc collector] (data-collector data-type)
        [envelope checksum] (ais-ex/extract-envelope-checksum line)]
    (if (not-any? nil? [envelope checksum])
      (if (= (ais-util/checksum envelope) checksum)
        (try
	  (let [bits (ais-util/pad
                       (payload->binary (ais-ex/extract-payload envelope)) 
