 
 (defn types-hash-map->dot-language
   "Convert a PDDL types hash-map
-to the dot language notation"
+to the DOT language notation"
   [pddl-types-map]
   (clojure.string/join "\n"
                        (map types-map-entry->dot-language
                             pddl-types-map)))
 
 (defn PDDL->dot-with-style
-  "Add dot template"
+  "Add DOT template"
   [preds types dot-template]
   (let [template (slurp dot-template)
         predicates (clojure.string/join
                     (hash-map->dot
                      (all-pddl-preds->hash-map preds)))
         types (types-hash-map->dot-language
-                (types->hash-map types))]
+               (types->hash-map types))]
+    ;; Replace GENERATED in template with new content
     (clojure.string/replace  template
                              #"GENERATED"
                              (str predicates types))))
 
 
 (defn PDDL->dot
-  "Takes a complete PDDL file
-and generates a UML type diagram"
+  "Take a complete PDDL file
+and generate a type diagram"
   [pddl-file dot-template]
   (PDDL->dot-with-style (pci/get-PDDL-predicates pddl-file)
                         (pci/get-PDDL-types pddl-file)
                         dot-template))
 
-;;; Copied from https://www.refheap.com/9034
+;;; Source: https://www.refheap.com/9034
 (defn exit-on-close [sketch]
-  "Guarantees that Clojure script will be
-exited after the JFrame is closed"
+  "Exit Clojure script after the JFrame is closed"
   (let [frame (-> sketch .getParent .getParent .getParent .getParent)]
     (.setDefaultCloseOperation frame javax.swing.JFrame/EXIT_ON_CLOSE)))
-  
+
 
 (defn -main
-  "Runs the input/output scripts"
+  "Run myPDDL"
   [& args]
   (let [tool (first args)]
     (cond



(defn all-pddl-preds->hash-map
  "Takes a list of PDDL predicates and
  returns a hash-map of types and the
  assigned predicate"
  [pddl-preds]
  ;; remove :predicates keyword
  (let [pddl-preds (if (= :predicates (first pddl-preds))

       ;; Create dot language file in dot folder.
       (doall
        (pci/write->file new-dot-filename
                         (print (PDDL->dot input-domain dot-template))))

       ;; Create a png file from dot
       (fs/exec "dot" "-Tpng" "-o" new-png-filename new-dot-filename)

       ;; Open image with external program or with built-in JFrame?
       (if-not (= image-displayer "auto")
         ;; External
         (doall
          (fs/exec image-displayer new-png-filename)
          (System/exit 0))
         (doall
          ;; Built-In
          
       ;; Settings for displaying the generated diagram.
       (def img (ref nil))
       
