Index: calculatorview/src/sans/perspectives/calculator/model_editor.py
===================================================================
--- calculatorview/src/sans/perspectives/calculator/model_editor.py	(revision 6f140f2b7ee93e52dce795ce3d1b3010a48f3268)
+++ calculatorview/src/sans/perspectives/calculator/model_editor.py	(revision b25caad2957d5d520b0b1b862001070ac1104add)
@@ -294,4 +294,5 @@
         self.param_tcl = EditWindow(self, id, wx.DefaultPosition, 
                             wx.DefaultSize, wx.CLIP_CHILDREN|wx.SUNKEN_BORDER)
+        self.param_tcl.setDisplayLineNumbers(True)
         self.param_tcl.SetToolTipString(param_tip)
         self.param_sizer.AddMany([(param_txt, 0, wx.LEFT, 10),
@@ -305,9 +306,14 @@
         function_txt = wx.StaticText(self, -1, 'Function(x) : ') 
         hint_function = "#Example:\n"
-        hint_function += "y = A + B * numpy.sin(x * math.pi)\n"
-        hint_function += "return y"
+        hint_function += "new_x = x * math.pi\n"
+        hint_function += "if new_x <= 0:\n"
+        hint_function += "    y = A + B\n"
+        hint_function += "else:\n"
+        hint_function += "    y = A + B * numpy.cos(new_x)\n"
+        hint_function += "return y\n"
         id  = wx.NewId() 
         self.function_tcl = EditWindow(self, id, wx.DefaultPosition, 
                             wx.DefaultSize, wx.CLIP_CHILDREN|wx.SUNKEN_BORDER)
+        self.function_tcl.setDisplayLineNumbers(True)
         self.function_tcl.SetToolTipString(hint_function)
         self.function_sizer.Add(function_txt, 0, wx.LEFT, 10)
@@ -567,5 +573,6 @@
         On close event
         """
-        self.parent.new_model_frame = None
+        if self.parent != None:
+            self.parent.new_model_frame = None
         self.Destroy()  
 
Index: fittingview/src/sans/perspectives/fitting/fitting.py
===================================================================
--- fittingview/src/sans/perspectives/fitting/fitting.py	(revision 6f140f2b7ee93e52dce795ce3d1b3010a48f3268)
+++ fittingview/src/sans/perspectives/fitting/fitting.py	(revision b25caad2957d5d520b0b1b862001070ac1104add)
@@ -249,4 +249,26 @@
         frame.Show(True) 
     
+    def delete_custom_model(self, event):
+        """
+        Delete custom model file
+        """
+        id = event.GetId()
+        label = self.delete_menu.GetLabel(id)
+        toks = os.path.splitext(label)
+        path = os.path.join(models.find_plugins_dir(), toks[0])
+        try:
+            for ext in ['.py', '.pyc']:
+                p_path = path + ext
+                os.remove(p_path)
+            self.update_custom_combo()
+            self.delete_menu.Delete(id)
+            for item in self.edit_menu.GetMenuItems():
+                if item.GetLabel() == label:
+                    self.edit_menu.DeleteItem(item)
+                    break
+        except:
+            msg ='Delete Error: \nCould not delete the file; Check if in use.'
+            wx.MessageBox(msg)
+    
     def make_sum_model(self, event):
         """
@@ -258,5 +280,5 @@
         model_list = model_manager.get_model_name_list()
 
-        textdial = TextDialog(None, -1, 'Modify Sum(p1, p2) Model', model_list)
+        textdial = TextDialog(None, -1, 'Easy Sum(p1, p2)', model_list)
         self.put_icon(textdial)
         if textdial.ShowModal() == wx.ID_OK:
@@ -264,5 +286,5 @@
                 label = textdial.getText()
                 plug_dir = models.find_plugins_dir()
-                fname = os.path.join(plug_dir, "sum_temp.py")
+                fname = os.path.join(plug_dir, "easy_sum_of_p1_p2.py")
                 name1 = label[0]
                 name2 = label[1]
@@ -300,4 +322,7 @@
         """
         try:
+            # Update edit menus
+            self.set_edit_menu_helper(self.parent, self.edit_custom_model)
+            self.set_edit_menu_helper(self.parent, self.delete_custom_model)
             temp = self.fit_panel.reset_pmodel_list()
             if temp:
@@ -309,6 +334,9 @@
                         pos = page.formfactorbox.GetSelection()
                         page._show_combox_helper()
-                        page.formfactorbox.SetSelection(pos)
-                        page.formfactorbox.SetValue(current_val)
+                        new_val = page.formfactorbox.GetValue()
+                        if current_val != new_val and new_val != '':
+                            page.formfactorbox.SetValue(new_val)
+                        else:
+                            page.formfactorbox.SetValue(current_val)
         except:
             pass
@@ -321,10 +349,10 @@
         id = wx.NewId()
         #new_model_menu = wx.Menu()
-        self.edit_model_menu.Append(id, 'New Model Function', 
+        self.edit_model_menu.Append(id, 'New', 
                                    'Add a new model function')#, 
                                    #new_model_menu) 
         wx.EVT_MENU(owner, id,  self.make_new_model)
         id = wx.NewId()
-        self.edit_model_menu.Append(id, 'Modify Sum(p1, p2)', 
+        self.edit_model_menu.Append(id, 'Sum(p1, p2)', 
                                     'Sum of two model functions') 
         wx.EVT_MENU(owner, id,  self.make_sum_model)
@@ -332,8 +360,14 @@
         self.edit_menu =wx.Menu()
         self.edit_model_menu.AppendMenu(e_id, 
-                                    'Advanced Edit', self.edit_menu) 
-        self.set_edit_menu_helper(owner)
-    
-    def set_edit_menu_helper(self, owner):
+                                    'Advanced', self.edit_menu) 
+        self.set_edit_menu_helper(owner, self.edit_custom_model)
+
+        d_id = wx.NewId()
+        self.delete_menu =wx.Menu()
+        self.edit_model_menu.AppendMenu(d_id, 
+                                    'Delete', self.delete_menu)
+        self.set_edit_menu_helper(owner, self.delete_custom_model)
+    
+    def set_edit_menu_helper(self, owner, menu):
         """
         help for setting list of the edit model menu labels
@@ -343,14 +377,20 @@
             name = os.path.basename(item)
             toks = os.path.splitext(name)
-            if toks[1]=='.py' and not toks[0] =='__init__' \
-                                and not toks[0] =='sum_temp':
+            if toks[-1]=='.py' and not toks[0] =='__init__':
+                if menu == self.edit_custom_model:
+                    if toks[0] =='easy_sum_of_p1_p2':
+                        continue
+                    submenu = self.edit_menu
+                else:
+                    submenu = self.delete_menu
+                    #name = toks[0]
                 has_file = False
-                for item in self.edit_menu.GetMenuItems():
-                    if name == self.edit_menu.GetLabel(item.GetId()):
+                for item in submenu.GetMenuItems():
+                    if name == submenu.GetLabel(item.GetId()):
                         has_file = True
                 if not has_file:
                     id = wx.NewId()
-                    self.edit_menu.Append(id, name) 
-                    wx.EVT_MENU(owner, id,  self.edit_custom_model)
+                    submenu.Append(id, name) 
+                    wx.EVT_MENU(owner, id,  menu)
                     has_file = False
 
