Index: src/sas/sasgui/guiframe/data_panel.py
===================================================================
--- src/sas/sasgui/guiframe/data_panel.py	(revision e767897d6a10f25bfe2bccbef3e3fe6ab0385f7c)
+++ src/sas/sasgui/guiframe/data_panel.py	(revision 998ca90ad87500d7d5fb3f4eb13105752a2f2952)
@@ -890,14 +890,15 @@
 
 
-    def on_remove(self, event):
+    def on_remove(self, event, msg=""):
         """
         Get a list of item checked and remove them from the treectrl
         Ask the parent to remove reference to this item
         """
-        msg = "This operation will delete the data sets checked "
-        msg += "and all the dependents."
+        if msg == "":
+            msg = "This operation will delete the data sets checked "
+            msg += "and all the dependents."
         msg_box = wx.MessageDialog(None, msg, 'Warning', wx.OK|wx.CANCEL)
         if msg_box.ShowModal() != wx.ID_OK:
-            return
+            return True
 
         data_to_remove, theory_to_remove, _ = self.set_data_helper()
Index: src/sas/sasgui/guiframe/gui_manager.py
===================================================================
--- src/sas/sasgui/guiframe/gui_manager.py	(revision 3fac0df814fa16cb4e81b12f38998515162dd09a)
+++ src/sas/sasgui/guiframe/gui_manager.py	(revision 998ca90ad87500d7d5fb3f4eb13105752a2f2952)
@@ -1904,16 +1904,37 @@
         if self._default_save_location == None:
             self._default_save_location = os.getcwd()
-        wx.PostEvent(self, StatusEvent(status="Loading Project file..."))
-        dlg = wx.FileDialog(self,
+        msg = "This operation will set SasView to its freshly opened state "
+        msg += "before loading the project. Do you wish to continue?"
+        if not self._data_panel.on_remove(None, msg):
+            wx.PostEvent(self, StatusEvent(status="Loading Project file..."))
+            dlg = wx.FileDialog(self,
                             "Choose a file",
                             self._default_save_location, "",
                             APPLICATION_WLIST)
-        if dlg.ShowModal() == wx.ID_OK:
-            path = dlg.GetPath()
+            if dlg.ShowModal() == wx.ID_OK:
+                path = dlg.GetPath()
             if path is not None:
                 self._default_save_location = os.path.dirname(path)
-        dlg.Destroy()
-
-        self.load_state(path=path, is_project=True)
+                dlg.Destroy()
+
+            # Reset to a base state
+            self._on_reset_state()
+
+            # Load the project file
+            self.load_state(path=path, is_project=True)
+
+    def _on_reset_state(self):
+        """
+        Resets SasView to its freshly opened state.
+        :return: None
+        """
+        # Reset all plugins to their base state
+        for plugin in self.plugins:
+            plugin.clear_panel()
+        # Reset plot number to 0
+        self.graph_num = 0
+        # Remove all loaded data
+        self._data_panel.selection_cbox.SetValue('Select all Data')
+        self._data_panel._on_selection_type(None)
 
     def _on_save_application(self, event):
@@ -2063,20 +2084,5 @@
             except:
                 logging.info("Failed to connect to www.sasview.org")
-        self._process_version(version_info, standalone=event == None)    
-
-        
-        
-#         
-#         try:
-#             req = urllib2.Request(config.__update_URL__)
-#             res = urllib2.urlopen(req)
-#             content = res.read().strip()
-#             logging.info("Connected to www.sasview.org. Latest version: %s"
-#                          % (content))
-#             version_info = json.loads(content)
-#         except:
-#             logging.info("Failed to connect to www.sasview.org")
-#             version_info = {"version": "0.0.0"}
-#         self._process_version(version_info, standalone=event == None)
+        self._process_version(version_info, standalone=event == None)
 
     def _process_version(self, version_info, standalone=True):
Index: src/sas/sasgui/perspectives/fitting/fitpanel.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/fitpanel.py	(revision a95ae9a74d8ba4ec9ee4b79e7e55739860f0b63f)
+++ src/sas/sasgui/perspectives/fitting/fitpanel.py	(revision 998ca90ad87500d7d5fb3f4eb13105752a2f2952)
@@ -200,8 +200,10 @@
             nop = nop - 1
 
-        ## save the title of the last page tab added
+        # save the title of the last page tab added
         self.fit_page_name = {}
-        ## list of existing fit page
+        # list of existing fit page
         self.opened_pages = {}
+        self.fit_page_index = 0
+        self.batch_page_index = 0
 
     def set_state(self, state):
@@ -242,4 +244,6 @@
         self.close_all()
         self._manager.mypanels = []
+        self.sim_page = None
+        self.batch_page = None
 
     def on_close_page(self, event=None):
Index: src/sas/sasgui/perspectives/fitting/pagestate.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/pagestate.py	(revision e89aed5c946bf39b3cb963b0c7805341c30d2432)
+++ src/sas/sasgui/perspectives/fitting/pagestate.py	(revision 998ca90ad87500d7d5fb3f4eb13105752a2f2952)
@@ -378,6 +378,8 @@
 
         rep += "State created: %s\n" % time_str
-        rep += "State form factor combobox selection: %s\n" % self.formfactorcombobox
-        rep += "State structure factor combobox selection: %s\n" % self.structurecombobox
+        rep += "State form factor combobox selection: %s\n" % \
+               self.formfactorcombobox
+        rep += "State structure factor combobox selection: %s\n" % \
+               self.structurecombobox
         rep += "is data : %s\n" % self.is_data
         rep += "data's name : %s\n" % self.data_name
@@ -639,11 +641,11 @@
 
         Compatible with standalone writing, or appending to an
-        already existing XML document. In that case, the XML document
-        is required. An optional entry node in the XML document may also be given.
+        already existing XML document. In that case, the XML document is
+        required. An optional entry node in the XML document may also be given.
 
         :param file: file to write to
         :param doc: XML document object [optional]
-        :param entry_node: XML node within the XML document at which we will append the data [optional]
-
+        :param entry_node: XML node within the XML document at which we
+                           will append the data [optional]
         """
         from xml.dom.minidom import getDOMImplementation
@@ -744,5 +746,6 @@
         for item in LIST_OF_STATE_PARAMETERS:
             element = newdoc.createElement(item[0])
-            self._toXML_helper(thelist=getattr(self, item[1]), element=element, newdoc=newdoc)
+            self._toXML_helper(thelist=getattr(self, item[1]),
+                               element=element, newdoc=newdoc)
             inputs.appendChild(element)
 
@@ -761,15 +764,16 @@
             batch_combo.appendChild(constraints)
             for constraint in batch_fit_state.constraints_list:
-                # model_cbox, param_cbox, egal_txt, constraint, btRemove, sizer
-                doc_cons = newdoc.createElement('constraint')
-                doc_cons.setAttribute('model_cbox',
-                                      str(constraint.model_cbox.GetValue()))
-                doc_cons.setAttribute('param_cbox',
-                                      str(constraint.param_cbox.GetValue()))
-                doc_cons.setAttribute('egal_txt',
-                                      str(constraint.egal_txt.GetLabel()))
-                doc_cons.setAttribute('constraint',
-                                      str(constraint.constraint.GetValue()))
-                constraints.appendChild(doc_cons)
+                if constraint.model_cbox.GetValue() != "":
+                    # model_cbox, param_cbox, egal_txt, constraint, btRemove, sizer
+                    doc_cons = newdoc.createElement('constraint')
+                    doc_cons.setAttribute('model_cbox',
+                                          str(constraint.model_cbox.GetValue()))
+                    doc_cons.setAttribute('param_cbox',
+                                          str(constraint.param_cbox.GetValue()))
+                    doc_cons.setAttribute('egal_txt',
+                                          str(constraint.egal_txt.GetLabel()))
+                    doc_cons.setAttribute('constraint',
+                                          str(constraint.constraint.GetValue()))
+                    constraints.appendChild(doc_cons)
 
             # Save all models
@@ -912,6 +916,6 @@
                                 value = cls.type
                             except Exception:
-                                logging.error("unable to load distribution %r for %s"
-                                              % (value, parameter))
+                                base = "unable to load distribution %r for %s"
+                                logging.error(base % (value, parameter))
                                 continue
                         _disp_obj_dict = getattr(self, varname)
@@ -1036,11 +1040,13 @@
             raise RuntimeError, "The cansas writer expects a Data2D instance"
 
+        title = "cansas1d/%s" % self.version
+        title += "http://svn.smallangles.net/svn/canSAS/1dwg/trunk/cansas1d.xsd"
         doc = xml.dom.minidom.Document()
         main_node = doc.createElement("SASroot")
         main_node.setAttribute("version", self.version)
         main_node.setAttribute("xmlns", "cansas1d/%s" % self.version)
-        main_node.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")
-        main_node.setAttribute("xsi:schemaLocation",
-                               "cansas1d/%s http://svn.smallangles.net/svn/canSAS/1dwg/trunk/cansas1d.xsd" % self.version)
+        main_node.setAttribute("xmlns:xsi",
+                               "http://www.w3.org/2001/XMLSchema-instance")
+        main_node.setAttribute("xsi:schemaLocation", title)
 
         doc.appendChild(main_node)
@@ -1051,8 +1057,10 @@
         write_node(doc, entry_node, "Title", datainfo.title)
         if datainfo is not None:
-            write_node(doc, entry_node, "data_class", datainfo.__class__.__name__)
+            write_node(doc, entry_node, "data_class",
+                       datainfo.__class__.__name__)
         for item in datainfo.run:
             runname = {}
-            if datainfo.run_name.has_key(item) and len(str(datainfo.run_name[item])) > 1:
+            if datainfo.run_name.has_key(item) and \
+                            len(str(datainfo.run_name[item])) > 1:
                 runname = {'name': datainfo.run_name[item]}
             write_node(doc, entry_node, "Run", item, runname)
@@ -1313,12 +1321,13 @@
                                                namespaces={'ns': CANSAS_NS})
                 model_list_items = model_list[0].xpath('ns:model_list_item',
-                                                       namespaces={'ns': CANSAS_NS})
+                                                   namespaces={'ns': CANSAS_NS})
                 for model in model_list_items:
                     attrs = model.attrib
                     sim_fit_state.model_list.append(attrs)
+
                 constraints = simfitstate_0.xpath('ns:constraints',
                                                 namespaces={'ns': CANSAS_NS})
                 constraint_list = constraints[0].xpath('ns:constraint',
-                                                       namespaces={'ns': CANSAS_NS})
+                                               namespaces={'ns': CANSAS_NS})
                 for constraint in constraint_list:
                     attrs = constraint.attrib
@@ -1388,5 +1397,6 @@
                         data_info.notes.append(note_value)
             except Exception:
-                err_mess = "cansas_reader.read: error processing entry notes\n  %s" % sys.exc_value
+                err_mess = "cansas_reader.read: error processing entry notes\n"
+                err_mess += "  %s" % sys.exc_value
                 self.errors.append(err_mess)
                 logging.error(err_mess)
@@ -1398,9 +1408,13 @@
 
         self._store_content('ns:SASsample/ns:ID', dom, 'ID', data_info.sample)
-        self._store_float('ns:SASsample/ns:thickness', dom, 'thickness', data_info.sample)
-        self._store_float('ns:SASsample/ns:transmission', dom, 'transmission', data_info.sample)
-        self._store_float('ns:SASsample/ns:temperature', dom, 'temperature', data_info.sample)
-
-        nodes = dom.xpath('ns:SASsample/ns:details', namespaces={'ns': CANSAS_NS})
+        self._store_float('ns:SASsample/ns:thickness', dom, 'thickness',
+                          data_info.sample)
+        self._store_float('ns:SASsample/ns:transmission', dom, 'transmission',
+                          data_info.sample)
+        self._store_float('ns:SASsample/ns:temperature', dom, 'temperature',
+                          data_info.sample)
+
+        nodes = dom.xpath('ns:SASsample/ns:details',
+                          namespaces={'ns': CANSAS_NS})
         for item in nodes:
             try:
@@ -1410,12 +1424,16 @@
                         data_info.sample.details.append(detail_value)
             except Exception:
-                err_mess = "cansas_reader.read: error processing sample details\n  %s" % sys.exc_value
+                err_mess = "cansas_reader.read: error processing entry notes\n"
+                err_mess += "  %s" % sys.exc_value
                 self.errors.append(err_mess)
                 logging.error(err_mess)
 
         # Position (as a vector)
-        self._store_float('ns:SASsample/ns:position/ns:x', dom, 'position.x', data_info.sample)
-        self._store_float('ns:SASsample/ns:position/ns:y', dom, 'position.y', data_info.sample)
-        self._store_float('ns:SASsample/ns:position/ns:z', dom, 'position.z', data_info.sample)
+        self._store_float('ns:SASsample/ns:position/ns:x', dom, 'position.x',
+                          data_info.sample)
+        self._store_float('ns:SASsample/ns:position/ns:y', dom, 'position.y',
+                          data_info.sample)
+        self._store_float('ns:SASsample/ns:position/ns:z', dom, 'position.z',
+                          data_info.sample)
 
         # Orientation (as a vector)
@@ -1551,5 +1569,6 @@
                         process.term.append(term_attr)
                 except:
-                    err_mess = "cansas_reader.read: error processing process term\n  %s" % sys.exc_value
+                    err_mess = "cansas_reader.read: error processing "
+                    err_mess += "entry notes\n  %s" % sys.exc_value
                     self.errors.append(err_mess)
                     logging.error(err_mess)
@@ -1579,5 +1598,6 @@
                 value_list = []
                 if field is not None:
-                    value_list = [parse_entry_helper(node, item) for node in field]
+                    value_list = \
+                        [parse_entry_helper(node, item) for node in field]
                 if len(value_list) < 2:
                     setattr(data_info, item[0], None)
@@ -1613,4 +1633,5 @@
                     entry_list = root.xpath('ns:SASentry',
                                             namespaces={'ns': CANSAS_NS})
+                    name_map = {}
                     for entry in entry_list:
                         try:
Index: src/sas/sasgui/perspectives/fitting/simfitpage.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/simfitpage.py	(revision 4fea1df3346e74844ba5587f0cf0192bc0922373)
+++ src/sas/sasgui/perspectives/fitting/simfitpage.py	(revision 998ca90ad87500d7d5fb3f4eb13105752a2f2952)
@@ -1050,5 +1050,4 @@
         """
 
-        # FIXME: Not tracking data set name on loading ==> NECESSARY!
         model_map = {}
         if fit.fit_panel.sim_page is None:
@@ -1069,5 +1068,5 @@
                     check = bool(saved_model.pop('checked'))
                     sim_page.model_list[i][0].SetValue(check)
-                    continue
+                    break
             i += 1
         sim_page.check_model_name(None)
@@ -1080,17 +1079,18 @@
         for index, item in enumerate(self.constraints_list):
             model_cbox = item.pop('model_cbox')
-            constraint_value = item.pop('constraint')
-            param = item.pop('param_cbox')
-            equality = item.pop('egal_txt')
-            for key, value in model_map.iteritems():
-                model_cbox.replace(key, value)
-                constraint_value.replace(key, value)
-
-            sim_page.constraints_list[index][0].SetValue(model_cbox)
-            sim_page._on_select_model(None)
-            sim_page.constraints_list[index][1].SetValue(param)
-            sim_page.constraints_list[index][2].SetLabel(equality)
-            sim_page.constraints_list[index][3].SetValue(constraint_value)
-            sim_page._on_add_constraint(None)
+            if model_cbox != "":
+                constraint_value = item.pop('constraint')
+                param = item.pop('param_cbox')
+                equality = item.pop('egal_txt')
+                for key, value in model_map.iteritems():
+                    model_cbox.replace(key, value)
+                    constraint_value.replace(key, value)
+
+                sim_page.constraints_list[index][0].SetValue(model_cbox)
+                sim_page._on_select_model(None)
+                sim_page.constraints_list[index][1].SetValue(param)
+                sim_page.constraints_list[index][2].SetLabel(equality)
+                sim_page.constraints_list[index][3].SetValue(constraint_value)
+                sim_page._on_add_constraint(None)
 
     def _format_id(self, original_id):
