   (let [hmap1 (split prmp #" ")
         hmap2 (apply hash-map hmap1)]
     (clojure.walk/keywordize-keys hmap2)))
+
+(defn make-pivot-map
+  [prow pivots]
+  ;; build up pkey and pval, then hash-map
+  (for [pivot pivots]
+    (let [pkey (nth prow pivot)])))
+  
         
 (defn handle-multimodplldisplay4
   "In this version pivot/keyset can be generalized beyond png any col (eventually any sequence of cols) between col-1 and token column. (Need to find out how to 'presort' cols before initial display?)"
-  [pdgms headerset2 pdgmstr2 pivotname]
+  [pdgms headerset2 pdgmstr2 pivotlist]
   (let [pnamestr (clojure.string/replace pdgms #"[\[\]\"]" "")
         pnames (split pnamestr #" ")
-        pivot (read-string pivotname)
+        ;;pivot (read-string pivotname)
         ;; get rid of spurious line-feeds
         ;;pdgmstr2a (str pdgmstr2)
         pdgmstr3 (cleanpdgms pdgmstr2)
         ;; map each 'val-string-w/o-pivot-val token' to token
         prows (split pdgmstr3 #"\\r\\n")
         pcells (for [prow prows] (split prow #","))
-        pivot-map (for [prow pcells] (hash-map (nth prow pivot) (vec-remove prow pivot)))
+        ;; build up pkey by joining pivot-vals and pval by removing pivot-vals
+        pklist (make-pklist pcells pivotlist)
+        pvlist (make-pvlist pcells pivotlist)
+        pivots (split pivotlist #",")
+        pivot-map (for [prow pcells] (hash-map pkey pval))
+        ;; pivot-map (for [prow pcells] (hash-map (nth prow pivot) (vec-remove prow pivot)))
+        pivot-map (for [prow pcells] (make-pivot-map prow pivots))
         ;; group the val-tokens associated with each pivot val
         newpdgms (merge-matches pivot-map)
+        pdgmnums (into [] (take (clojure.core/count pnames) (iterate inc 1)))
         ;; make a vector of pivot vals
+        ;;pvalvec (vec (for [pdgmnum pdgmnums] (str "P-" pdgmnum)))
+        ;;pnames2 (vec (for [npdgm newpdgms] (str (key npdgm))))
         pvalvec (vec (for [npdgm newpdgms] (str (key npdgm))))
         ;; e.g., ["Plural" "Singular"]
         ;; make a vector of pdgm rows for each pivot

                (for [npg npgs]
                  [:td npg])
                (for [pmap pmaps]
               [:td (kstrkey pmap)])])]) ]
      [:script {:src "js/goog/base.js" :type "text/javascript"}]
      [:script {:src "js/webapp.js" :type "text/javascript"}]
      [:script {:type "text/javascript"}
       "goog.require('webapp.core');"]]])))


(defroutes multipdgmmod-routes

        pmaps (for [prmap prmaps] (apply conj prmap))
        headerset3 (clojure.string/replace headerset2 #"[\[\]\"]" "")
        heads (split (str headerset3) #" ")
        headvec (vec-remove heads pivotlist)
        ;; set of lists of vaue-combination-terms
        keylists (set (for [pmap pmaps] (keys pmap)))
        ;;keylists (set (keys pmap))
