Index: calculatorview/src/sans/perspectives/calculator/model_editor.py
===================================================================
--- calculatorview/src/sans/perspectives/calculator/model_editor.py	(revision 7434020a097527ae6efc0f0e238d753b17df8b04)
+++ calculatorview/src/sans/perspectives/calculator/model_editor.py	(revision d83549c1f6e5781ff401c9758ff5d6fc909a9735)
@@ -221,4 +221,5 @@
         self.name = 'untitled'
         self.overwrite_name = True
+        self.is_2d = False
         self.fname = None
         self.param_strings = ''
@@ -472,6 +473,12 @@
         lines = CUSTOM_TEMPLATE.split('\n')
         has_scipy = func_str.count("scipy.")
+        self.is_2d = func_str.count("#self.ndim = 2")
+        line_2d = ''
+        if self.is_2d:
+            line_2d = CUSTOM_2D_TEMP.split('\n')
+        line_test = TEST_TEMPLATE.split('\n')
         local_params = ''
         spaces = '        '#8spaces
+        # write function here
         for line in lines:
             # The location where to put the strings is 
@@ -492,4 +499,10 @@
                     desc= self.name
                 out_f.write(line% desc + "\n")
+            elif line.count("def function(self, x=0.0%s):"):
+                if self.is_2d:
+                    y_str = ', y=0.0'
+                    out_f.write(line% y_str + "\n")
+                else:
+                    out_f.write(line% '' + "\n")
             elif line.count("#function here"):
                 for func_line in func_str.split('\n'):
@@ -498,5 +511,8 @@
                         out_f.write(spaces + f_line + "\n")
                 if not func_str:
-                    out_f.write(spaces + 'return y' + "\n")
+                    dep_var = 'y'
+                    if self.is_2d:
+                        dep_var = 'z'
+                    out_f.write(spaces + 'return %s'% dep_var + "\n")
             elif line.count("#import scipy?"):
                 if has_scipy:
@@ -506,4 +522,12 @@
             elif line:
                 out_f.write(line + "\n")
+        # run string for 2d
+        if line_2d:
+            for line in line_2d:
+                out_f.write(line + "\n")
+        # Test strins
+        for line in line_test:
+            out_f.write(line + "\n")
+   
         out_f.close() 
     
@@ -590,7 +614,9 @@
         self.description = "%s"
         self.set_details()
-    def function(self, x = 0.0):
+    def function(self, x=0.0%s):
         #local params here
-        #function here  
+        #function here
+"""
+TEST_TEMPLATE = """
 ######################################################################
 ## THIS IS FOR TEST. DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       
@@ -609,6 +635,41 @@
     else:
         print "===> Simple Test: Failed!"
-"""        
-        
+"""    
+CUSTOM_2D_TEMP = """
+    def run(self, x=0.0):
+        if x.__class__.__name__ == 'list':
+            x_val = x[0]*math.cos(x[1])
+            y_val = x[0]*math.sin(x[1])
+            return self.function(x_val, y_val)
+        elif x.__class__.__name__ == 'tuple':
+            msg = "Tuples are not allowed as input to BaseComponent models"
+            raise ValueError, msg
+        else:
+            return self.function(x, x)
+    def runXY(self, x=0.0, y=0.0):
+        if x.__class__.__name__ == 'list':
+            return self.function(x, y)
+        elif x.__class__.__name__ == 'tuple':
+            msg = "Tuples are not allowed as input to BaseComponent models"
+            raise ValueError, msg
+        else:
+            return self.function(x, y)
+    def evalDistribution(self, qdist):
+        if qdist.__class__.__name__ == 'list':
+            msg = "evalDistribution expects a list of 2 ndarrays"
+            if len(qdist)!=2:
+                raise RuntimeError, msg
+            if qdist[0].__class__.__name__ != 'ndarray':
+                raise RuntimeError, msg
+            if qdist[1].__class__.__name__ != 'ndarray':
+                raise RuntimeError, msg
+            v_model = numpy.vectorize(self.runXY, otypes=[float])
+            iq_array = v_model(qdist[0], qdist[1])
+            return iq_array
+        elif qdist.__class__.__name__ == 'ndarray':
+            v_model = numpy.vectorize(self.runXY, otypes=[float])
+            iq_array = v_model(qdist)
+            return iq_array
+"""
 SUM_TEMPLATE = """
 # A sample of an experimental model function for Sum(Pmodel1,Pmodel2)
Index: fittingview/src/sans/perspectives/fitting/fitting.py
===================================================================
--- fittingview/src/sans/perspectives/fitting/fitting.py	(revision b25caad2957d5d520b0b1b862001070ac1104add)
+++ fittingview/src/sans/perspectives/fitting/fitting.py	(revision d83549c1f6e5781ff401c9758ff5d6fc909a9735)
@@ -369,8 +369,10 @@
         self.set_edit_menu_helper(owner, self.delete_custom_model)
     
-    def set_edit_menu_helper(self, owner, menu):
+    def set_edit_menu_helper(self, owner=None, menu=None):
         """
         help for setting list of the edit model menu labels
         """
+        if menu == None:
+            menu = self.edit_custom_model
         list_fnames = os.listdir(models.find_plugins_dir())
         for item in list_fnames:
