diff --git a/kadmos/vistoms/templates/VISTOMS.html b/kadmos/vistoms/templates/VISTOMS.html
index f812b40b4d0ce207bbd453b90a9fff78664047a9..8e849c8017747fe7583bf1befdae7ce9eb09656e 100644
--- a/kadmos/vistoms/templates/VISTOMS.html
+++ b/kadmos/vistoms/templates/VISTOMS.html
@@ -19399,15 +19399,39 @@
                                         else
                                         {   
                                             bootbox.hideAll();
-                                            var schema = currentGraph.variableSchemes[varCategories[0].description];
-                                            var treeData = (JSON.parse(JSON.stringify(schema)));				
-                                            
-                                            var graphElements = JSON.parse(result)
+											var treeData = (JSON.parse(JSON.stringify(currentGraph.variableSchemes[varCategories[0].description])));
+											var firstEl = treeData[0].xPath.split("/")[1]		
+
+											var graphElements = JSON.parse(result)
                                             var message = "";
-                                            
-                                            if (result.includes("/"+treeData.name))
+											
+											var variables = [];
+											var functions = [];
+											
+											if (result.includes("/"+firstEl))
                                             {
-                                                bootbox.prompt(
+												var pipeData = [];
+												//There are variables in the result
+												graphElements.forEach(function(graphElement)
+												{
+													if (graphElement.includes("/"+firstEl))
+													{ 
+														pipeData += ","+graphElement;
+													}
+													else
+													{
+														functions.push({name:graphElement,type:"function"})
+													}
+												})
+												variables = JSON.parse(JSON.stringify(treeData))
+												prune_tree(pipeData,variables)
+												
+												variables.forEach(function(variable)
+												{
+													variable.name = variable.xPath
+												})
+												
+												bootbox.prompt(
                                                 {
                                                     title: "The graph elements you requested contain variables. How do you want them displayed?",
                                                     inputType: 'checkbox',
@@ -19417,30 +19441,9 @@
                                                         if (result)
                                                         {
                                                             var message1 = "", message2 = "";
-                                                        
-                                                            var array = ""
-                                                            var list = [];
-                                                            graphElements.forEach(function(graphElement)
-                                                            {
-                                                                if (graphElement.includes("/"+treeData.name))
-                                                                {
-                                                                    if (result.includes("Tree View"))
-                                                                    {
-                                                                        if (array == ""){array += graphElement}
-                                                                        else{array += "," + graphElement}
-                                                                    }
-                                                                    if (result.includes("List"))
-                                                                    {
-                                                                        list.push({name:graphElement,type:"variable"});
-                                                                    }
-                                                                }
-                                                                else
-                                                                {
-                                                                    list.push({name:graphElement,type:"function"});
-                                                                }
-                                                            })
-                                                            
-                                                            if(array!="")
+                                                            var array
+                                                            bootbox.hideAll();
+                                                            if(result.includes("Tree View"))
                                                             {
                                                                 var headLine = "Tree Layout for category:\" " + category + "\", subcategory:\" " + sub_category + "\"";  
                                                                 var d3_body = d3.select("body");
@@ -19465,12 +19468,19 @@
                                                                 var treeLayout = treeLayoutSVG.append("g").attr("class","treeLayout");
                                                                 maketreeLayout(array, treeLayout, treeLayoutSVG, treeLayoutdiv, headLine, varCategories[0].description);
                                                             }
-                                                            
-                                                            show_bootBox_listMessage(list);
+															if (result.includes("List"))
+															{
+																var list = []
+																list = functions.concat(variables);
+																console.log(functions)
+																console.log(variables)
+																console.log(list)
+																show_bootBox_listMessage(list);
+															}
                                                         }
                                                     }
                                                 })
-                                            }
+											}
                                             else
                                             {
                                                 var list = [];
@@ -19512,7 +19522,9 @@
                                                             })
                                                         if (listElement.type=="variable")
                                                         {
-                                                            td.on("mousedown",function(){bootbox.alert("I'm a variable!")})
+                                                            td.on("mousedown",function(){
+																console.log(listElement)
+															})
                                                         }
                                                         else if (listElement.type=="function")
                                                         {
@@ -22446,7 +22458,7 @@
 			}
 			startXDSM(data,graphID);
 
-			////aigner: Unused funcktions --> Could be helpful at some point
+			////aigner: Unused functions --> Could be helpful at some point
 			////aigner: clone function, so that original object is not overwritten but deep copied
 			// function clone(obj) {
 				// if (null == obj || "object" != typeof obj) return obj;