 (defn template-key [dataset extract-type name]
   (str (template-qualifier dataset extract-type) name))
 
-(defn- template-with-metadata* [dataset file]
+(defn- template-with-metadata* [dataset ^java.io.File file]
   (let [file-name (.getName file)]
     {:dataset dataset
-     :extract-type (cond-> file 
+     :extract-type (cond-> file
                            (-> file .getParentFile .getName (= "partials")) .getParentFile
-                           true .getParentFile 
-                           true .getName) 
-     :name (subs file-name 0 (.lastIndexOf file-name ".")) 
+                           true .getParentFile
+                           true .getName)
+     :name (subs file-name 0 (.lastIndexOf file-name "."))
      :template (slurp (.getPath file))}))
 
 (defn templates-with-metadata [dataset template-location]
-    "Returns the template-contents with metadata included. 
+    "Returns the template-contents with metadata included.
      The metadata is based on dataset and where template-file in direcotry structure is located."
-  (let [template-files (filter #(.isFile %) (file-seq (io/file template-location)))]
+    (let [template-files (filter (fn [^java.io.File f] (.isFile f)) (file-seq (io/file template-location)))]
     (map (partial template-with-metadata* dataset) template-files)))
 
 (defn- clean-up [source]

  (let [template (clean-up template)
        template (m/replace-in-template template (template-qualifier dataset extract-type) "{{>")
        template-key (template-key dataset extract-type name)]
      (try 
        (m/register template-key template)
        (m/render template-key {}) ;check template can be rendered with empty map
        {:template template-key :status "registered"}

        (log/error "Template: " template-key " cannot be registered")
        (log/error e)
        false))))
