          (tag= :result) (tag= :MeasurementTimeseries)
          (attr= :gml/id measurement) (tag= :point) (tag= :MeasurementTVP)]
         points (eduction (apply comp path) [ennuste])]
+    (cleanup)
     (cond
       (:help cliopts)
       (println (str "-l, --location PLACE [" (:defaultlocation (config)) "]\n-m --measurement [" (:defaultmeasurement (config)) "]\n\nPossible values for measurement are:\n" (clojure.string/join " " (sort measurements))))

                     (:location cliopts))
        initfile (when (or ; fetch the XML if a cached copy doesn't exist or is over 15 mins old
                        (not (.exists (io/file filename)))
                        (> (- (.getTime (java.util.Date.))
                              (.lastModified (io/file filename)))
                           900000))
                   (spit filename
                         (:body
                          (client/get datauri))))

(def firstcontent (comp first :content))
(def secondcontent (comp second :content))

(defn olderthan
  "Is this file older than given time?"
  [suspect age]
  (> (- (.getTime (java.util.Date.))
        (.lastModified suspect))
     age))

(defn cleanup
  "Delete datafiles older than 30 minutes"
  []
  (let [dir (io/file ".")
        files (.listFiles dir)
        datafiles (filter #(re-find #"^weatherdata-.+xml$" (.getName %)) files) ]
    (map (fn [x]
           (when
               (olderthan x 1800000)
             (.delete x)))
         datafiles)))

(defn -main
  [& args]
  (let [climap (parse-opts args cli-options)
