Index: sansview/perspectives/fitting/basepage.py
===================================================================
--- sansview/perspectives/fitting/basepage.py	(revision 6bbeacd466719479cfdf24b6e7c1c5f52c93e03d)
+++ sansview/perspectives/fitting/basepage.py	(revision 5ef55d27cd7fa4428d6e625095e517c463fc814a)
@@ -1653,4 +1653,5 @@
                                     qstep= float(self.npts_x),
                                     id=self.id,
+                                    state = self.state,
                                     enable2D=self.enable2D)
         
Index: sansview/perspectives/fitting/fitting.py
===================================================================
--- sansview/perspectives/fitting/fitting.py	(revision 883e5f5d71629fa922e268a971a6f459db268374)
+++ sansview/perspectives/fitting/fitting.py	(revision 5ef55d27cd7fa4428d6e625095e517c463fc814a)
@@ -316,8 +316,10 @@
                 
                 data.group_id = state.data.group_id
+                self.parent.add_data(data_list=[data])
                 wx.PostEvent(self.parent, NewPlotEvent(plot=data,
                                         title=data.title))
                 page = self.fit_panel.set_state(state)   
             else:
+                self.parent.add_data(data_list=[data])
                 wx.PostEvent(self.parent, NewPlotEvent(plot=data,
                                         title=data.title))
@@ -452,4 +454,5 @@
     def draw_model(self, model, id, data=None, smearer=None,
                    enable1D=True, enable2D=False,
+                   state=None,
                    qmin=DEFAULT_QMIN, qmax=DEFAULT_QMAX, qstep=DEFAULT_NPTS):
         """
@@ -477,4 +480,5 @@
                                qmin=qmin,
                                qmax=qmax, 
+                               state=state,
                                qstep=qstep)
         else:     
@@ -487,4 +491,5 @@
                                 qmin=qmin,
                                 qmax=qmax,
+                                state=state,
                                 qstep=qstep)
             
@@ -629,8 +634,10 @@
         get this page and store it into the page_finder of this plug-in
         """
+        
         page = self.fit_panel.set_data(data)
         page_caption = page.window_name
         #append Data1D to the panel containing its theory
         #if theory already plotted
+        
         if page.id in self.page_finder:
             theory_data = self.page_finder[page.id].get_theory_data()
@@ -642,4 +649,6 @@
                     if group_id not in data.group_id:
                         data.group_id.append(group_id)
+            self.parent.update_data(prev_data=theory_data, new_data=data)
+                    
         self.store_data(id=page.id, data=data, caption=page.window_name)
         if self.sim_page is not None:
@@ -1079,5 +1088,5 @@
   
                 
-    def _complete1D(self, x,y, id, elapsed,index,model,data=None):
+    def _complete1D(self, x,y, id, elapsed,index,model,state=None, data=None):
         """
         Complete plotting 1D data
@@ -1095,9 +1104,7 @@
                     theory_data = self.page_finder[id].get_theory_data()
                     if theory_data is not None:
-                        print "theory_data", theory_data.group_id
                         group_id = theory_data.group_id[len(theory_data.group_id)-1]
                         if group_id not in data.group_id:
                             data.group_id.append(group_id)
-                        print "data", data.group_id
                 #data is plotted before the theory, then take its group_id
                 #assign to the new theory
@@ -1126,10 +1133,13 @@
             new_plot.yaxis(_yaxis, _yunit)
             self.page_finder[id].set_theory_data(new_plot)
-           
             if data is None:
-                wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot,
-                             title=str(new_plot.title)))
+                theory_data = self.page_finder[id].get_theory_data()
+                self.parent.add_data_helper(data_list=[theory_data])
+                data_id = theory_data.id
             else:
-                wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot,
+                data_id = data.id
+            self.parent.append_theory(data_id=data_id, 
+                                          theory=new_plot, state=state)
+            wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot,
                                             title= str(new_plot.title)))
             current_pg = self.fit_panel.get_page_by_id(id)
@@ -1156,5 +1166,5 @@
     
     def _complete2D(self, image, data, model, id,  elapsed, index, qmin,
-                     qmax, qstep=DEFAULT_NPTS):
+                     qmax, state=None,qstep=DEFAULT_NPTS):
         """
         Complete get the result of modelthread and create model 2D
@@ -1193,7 +1203,19 @@
             theory.xmin = data.xmin
             theory.xmax = data.xmax
+        theory.name = model.name + " ["+ str(model.__class__.__name__)+ "]"
         theory.title = "Analytical model 2D "
-        self.page_finder[id].set_theory_data(theory)
-        
+        theory_data = deepcopy(theory)
+        theory_data.name = "Unknown"
+        self.page_finder[id].set_theory_data(theory_data)
+        
+        if data is None:
+            theory_data = self.page_finder[id].get_theory_data()
+            self.parent.add_data_helper(data_list=[theory_data])
+            data_id = theory_data.id
+        else:
+            data_id = data.id
+        self.parent.append_theory(data_id=data_id, 
+                                          theory=theory, state=state)
+            
         ## plot
         wx.PostEvent(self.parent, NewPlotEvent(plot=theory,
@@ -1208,4 +1230,5 @@
     def _draw_model2D(self, model, id, data=None, smearer=None,
                       description=None, enable2D=False,
+                      state=None,
                       qmin=DEFAULT_QMIN, qmax=DEFAULT_QMAX,
                        qstep=DEFAULT_NPTS):
@@ -1257,4 +1280,5 @@
                                     qmax=qmax,
                                     qstep=qstep,
+                                    state=state,
                                     completefn=self._complete2D,
                                     updatefn=self._update2D)
@@ -1269,4 +1293,5 @@
     def _draw_model1D(self, model, id, data=None, smearer=None,
                 qmin=DEFAULT_QMIN, qmax=DEFAULT_QMAX, 
+                state=None,
                 qstep=DEFAULT_NPTS, enable1D=True):
         """
@@ -1305,4 +1330,5 @@
                                   qmax=qmax,
                                   smearer=smearer,
+                                  state=state,
                                   completefn=self._complete1D,
                                   updatefn=self._update1D)
Index: sansview/perspectives/fitting/model_thread.py
===================================================================
--- sansview/perspectives/fitting/model_thread.py	(revision 6bbeacd466719479cfdf24b6e7c1c5f52c93e03d)
+++ sansview/perspectives/fitting/model_thread.py	(revision 5ef55d27cd7fa4428d6e625095e517c463fc814a)
@@ -16,4 +16,5 @@
     def __init__(self, x, y, data,model,smearer,qmin, qmax,qstep,
                  id ,
+                 state=None,
                  completefn = None,
                  updatefn   = None,
@@ -33,4 +34,5 @@
         self.data= data
         self.page_id = id
+        self.state = None
         # the model on to calculate
         self.model = model
@@ -121,4 +123,5 @@
                        id=self.page_id,
                        model=self.model,
+                       state=self.state,
                        elapsed=elapsed,
                        index=index_model,
@@ -138,4 +141,5 @@
                  qmax=None,
                  smearer=None,
+                 state=None,
                  completefn = None,
                  updatefn   = None,
@@ -154,4 +158,5 @@
         self.qmax= qmax
         self.model = model
+        self.state = state
         self.page_id = id
         self.smearer= smearer
@@ -178,4 +183,5 @@
         self.complete(x=self.x[index], y=output[index], 
                       id=self.page_id,
+                      state=self.state,
                       elapsed=elapsed,index=index, model=self.model,
                                         data=self.data)
Index: sansview/perspectives/fitting/pagestate.py
===================================================================
--- sansview/perspectives/fitting/pagestate.py	(revision 90a7bbd9e20cfbcdbcd72d6d1e3b0391cb2fe486)
+++ sansview/perspectives/fitting/pagestate.py	(revision 5ef55d27cd7fa4428d6e625095e517c463fc814a)
@@ -329,5 +329,5 @@
             rep += "parameter unit: %s\n\n"%str(item[7])
         return rep
-    
+ 
     def __repr__(self):
         """ 
