Index: sansmodels/src/release_notes.txt
===================================================================
--- sansmodels/src/release_notes.txt	(revision b88c6e0129fd8fda86672933ab48d061d1f28299)
+++ sansmodels/src/release_notes.txt	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -9,5 +9,20 @@
     - Release date: ?
     - C extension models now use new C++ classes that incorporate dispersity and averaging
-      functionality. 
+      functionality. See utest_dispersity.py for examples of how to use the new dispersion
+      classes.
+      
+      # Create a model
+      model= CylinderModel()
+      
+      # Create a dispersion model
+      disp = GaussianDispersion()
+      
+	  # Set the dispersion for a chosen parameter
+	  model.set_dispersion('radius', disp)
+	  
+	  # Set the parameters of the dispersion model
+      model.dispersion['radius']['width'] = 5.0
+      model.dispersion['radius']['npts'] = 100
+
     
     Version 0.4.1
Index: sansmodels/src/sans/models/BaseComponent.py
===================================================================
--- sansmodels/src/sans/models/BaseComponent.py	(revision ae60f8613faa37cf4fa6112ca8cc43e854b4cdbd)
+++ sansmodels/src/sans/models/BaseComponent.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -38,10 +38,15 @@
     def clone(self):
         """ Returns a new object identical to the current object """
-        
         obj = copy.deepcopy(self)
+        return self._clone(obj)
+    
+    def _clone(self, obj):
+        """
+            Internal utility function to copy the internal
+            data members to a fresh copy.
+        """
         obj.params     = copy.deepcopy(self.params)
         obj.details    = copy.deepcopy(self.details)
         obj.dispersion = copy.deepcopy(self.dispersion)
-    
         return obj
 
@@ -70,47 +75,4 @@
             
         raise ValueError, "Model does not contain parameter %s" % name
-        
-
-    def _setParam(self, name, value):
-        """ 
-            Set the value of a model parameter
-        
-            @param name: name of the parameter
-            @param value: value of the parameter
-        """
-        # Look for dispersion parameters
-        toks = name.split('.')
-        if len(toks)==2 and toks[0] in self.dispersion:
-            # Setting a dispersion model parameter
-            if toks[1] in self.dispersion[toks[0]]: 
-                self.dispersion[toks[0]][toks[1]] = value
-                return
-            else:
-                raise ValueError, "Model does not contain parameter %s.%s" % (toks[0], toks[1])
-        
-        if name in self.params.keys():
-            self.params[name] = value
-        else:
-            raise ValueError, "Model does not contain parameter %s" % name
-        
-    def _getParam(self, name):
-        """ 
-            Set the value of a model parameter
-
-            @param name: name of the parameter
-        """
-        # Look for dispersion parameters
-        toks = name.split('.')
-        if len(toks)==2 and toks[0] in self.dispersion:
-            # Setting a dispersion model parameter
-            if toks[1] in self.dispersion[toks[0]]: 
-                return self.dispersion[toks[0]][toks[1]] 
-            else:
-                raise ValueError, "Model does not contain parameter %s.%s" % (toks[0], toks[1])
-
-        if name in self.params.keys():
-            return self.params[name]
-        else:
-            raise ValueError, "Model does not contain parameter %s" % name
         
     def getParam(self, name):
Index: sansmodels/src/sans/models/BaseModel.py
===================================================================
--- sansmodels/src/sans/models/BaseModel.py	(revision ae60f8613faa37cf4fa6112ca8cc43e854b4cdbd)
+++ sansmodels/src/sans/models/BaseModel.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -39,4 +39,6 @@
         self.value = value
         
+    def __str__(self):
+        return "%s: %g" % (self.name, self.value)
 
 class ParameterProperty(object):
@@ -68,9 +70,4 @@
         ## Dictionary of Parameter objects
         self.parameters = {}
-        
-        for item in self.params:
-            self.parameters[item] = Parameter(item, self.params[item])
-
-        
 
     # Evaluation methods to be implemented by the models
@@ -106,4 +103,5 @@
         if name in self.parameters:
             print "found"
+            #self.parameters[name].value = value
         return object.__setattr__(self, name, value)
         
Index: sansmodels/src/sans/models/CoreShellModel.py
===================================================================
--- sansmodels/src/sans/models/CoreShellModel.py	(revision 0f5bc9ff2027432913fd8d2cb067675244acdaf6)
+++ sansmodels/src/sans/models/CoreShellModel.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -65,7 +65,5 @@
     def clone(self):
         """ Return a identical copy of self """
-        obj = CoreShellModel()
-        obj.params = copy.deepcopy(self.params)
-        return obj   
+        return self._clone(CoreShellModel())   
    
     def run(self, x = 0.0):
Index: sansmodels/src/sans/models/CylinderModel.py
===================================================================
--- sansmodels/src/sans/models/CylinderModel.py	(revision af03ddd0932915d6659404ab7824e4223ea2944f)
+++ sansmodels/src/sans/models/CylinderModel.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -65,7 +65,5 @@
     def clone(self):
         """ Return a identical copy of self """
-        obj = CylinderModel()
-        obj.params = copy.deepcopy(self.params)
-        return obj   
+        return self._clone(CylinderModel())   
    
     def run(self, x = 0.0):
Index: sansmodels/src/sans/models/EllipsoidModel.py
===================================================================
--- sansmodels/src/sans/models/EllipsoidModel.py	(revision 0f5bc9ff2027432913fd8d2cb067675244acdaf6)
+++ sansmodels/src/sans/models/EllipsoidModel.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -65,7 +65,5 @@
     def clone(self):
         """ Return a identical copy of self """
-        obj = EllipsoidModel()
-        obj.params = copy.deepcopy(self.params)
-        return obj   
+        return self._clone(EllipsoidModel())   
    
     def run(self, x = 0.0):
Index: sansmodels/src/sans/models/EllipticalCylinderModel.py
===================================================================
--- sansmodels/src/sans/models/EllipticalCylinderModel.py	(revision 0f5bc9ff2027432913fd8d2cb067675244acdaf6)
+++ sansmodels/src/sans/models/EllipticalCylinderModel.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -69,7 +69,5 @@
     def clone(self):
         """ Return a identical copy of self """
-        obj = EllipticalCylinderModel()
-        obj.params = copy.deepcopy(self.params)
-        return obj   
+        return self._clone(EllipticalCylinderModel())   
    
     def run(self, x = 0.0):
Index: sansmodels/src/sans/models/ModelAdaptor.py
===================================================================
--- sansmodels/src/sans/models/ModelAdaptor.py	(revision ae60f8613faa37cf4fa6112ca8cc43e854b4cdbd)
+++ sansmodels/src/sans/models/ModelAdaptor.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -53,4 +53,6 @@
     def __init__(self):
         """ Initialization"""
+        ## Dictionary of Parameter objects
+        self.parameters = {}
         ## Dictionary of parameters, available for backward compatibility
         self.params = ParameterDict(self.parameters)
Index: sansmodels/src/sans/models/NewCylinderModel.py
===================================================================
--- sansmodels/src/sans/models/NewCylinderModel.py	(revision ae60f8613faa37cf4fa6112ca8cc43e854b4cdbd)
+++ sansmodels/src/sans/models/NewCylinderModel.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -22,5 +22,5 @@
 """
 
-from sans.models.BaseModel import BaseModel
+from sans.models.BaseModel import BaseModel, Parameter, ParameterProperty
 from sans_extension.c_models import CCylinderModel
 import copy    
@@ -41,5 +41,12 @@
 
     """
-        
+    scale      = ParameterProperty('scale')
+    radius     = ParameterProperty('radius')
+    length     = ParameterProperty('length')
+    contrast   = ParameterProperty('contrast')
+    background = ParameterProperty('background')
+    cyl_theta  = ParameterProperty('cyl_theta')
+    cyl_phi    = ParameterProperty('cyl_phi')
+    	
     def __init__(self):
         """ Initialization """
@@ -62,5 +69,8 @@
         self.details['cyl_phi'] = ['rad', None, None]
 
-   
+        # The C models have a self.params dictionary
+        for item in self.params:
+            self.parameters[item] = Parameter(item, self.params[item])
+
     def clone(self):
         """ Return a identical copy of self """
Index: sansmodels/src/sans/models/SphereModel.py
===================================================================
--- sansmodels/src/sans/models/SphereModel.py	(revision 0f5bc9ff2027432913fd8d2cb067675244acdaf6)
+++ sansmodels/src/sans/models/SphereModel.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -59,7 +59,5 @@
     def clone(self):
         """ Return a identical copy of self """
-        obj = SphereModel()
-        obj.params = copy.deepcopy(self.params)
-        return obj   
+        return self._clone(SphereModel())   
    
     def run(self, x = 0.0):
Index: sansmodels/src/sans/models/c_extensions/README.txt
===================================================================
--- sansmodels/src/sans/models/c_extensions/README.txt	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
+++ sansmodels/src/sans/models/c_extensions/README.txt	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -0,0 +1,21 @@
+NOTE ABOUT THE SANS MODELS REFACTOR [Oct 14, 2008]
+
+This is the code that was used to produce the first version of the
+SANS models. This code should be refactored to eliminate all the code 
+in c_extensions and merge it with the C++ code in c_models.
+
+- Some of the C code that was used to port the IGOR code is still used.
+  For instance, the functions defined in cylinder.c is used in c_models/cylinder.cpp.
+
+- As of writing, the C functions are used in the McVine code to implement
+  a simulated SANS instrument.
+  
+- The script c_extensions/WrapperGenerator.py is the original script 
+  that was used to generate the python C extensions for our models.
+  For instance, CCylinderModel.c was created with WrapperGenerator.py run
+  on cylinder.h.
+ 
+- See c_models/README.txt for more details about the new c_models.
+
+ 
+  
Index: nsmodels/src/sans/models/c_extensions/c_models.cpp
===================================================================
--- sansmodels/src/sans/models/c_extensions/c_models.cpp	(revision 0f5bc9ff2027432913fd8d2cb067675244acdaf6)
+++ 	(revision )
@@ -1,154 +1,0 @@
-/** c_models
- *
- * Module containing all SANS model extensions
- *
- * @author   M.Doucet / UTK
- */
-#include <Python.h>
-#include <parameters.hh>
-
-void addCCylinderModel(PyObject *module);
-void addCSphereModel(PyObject *module);
-void addCCoreShellModel(PyObject *module);
-void addCCoreShellCylinderModel(PyObject *module);
-void addCEllipsoidModel(PyObject *module);
-void addCEllipticalCylinderModel(PyObject *module);
-
-extern "C" {
-	//void addCCoreShellCylinderModel(PyObject *module);
-	//void addCCoreShellModel(PyObject *module);
-	//void addCEllipsoidModel(PyObject *module);
-	//void addCSphereModel(PyObject *module);
-	//void addCEllipticalCylinderModel(PyObject *module);
-	void addDisperser(PyObject *module);
-	void addCGaussian(PyObject *module);
-	void addCLorentzian(PyObject *module);
-}
-
-/**
- * Delete a dispersion model object
- */
-void del_dispersion_model(void *ptr){
-	DispersionModel * disp = static_cast<DispersionModel *>(ptr);
-	delete disp;
-	return;
-}
-
-/**
- * Create a dispersion model as a python object
- */
-PyObject * new_dispersion_model(PyObject *, PyObject *args) {
-	DispersionModel *disp = new DispersionModel();
-	return PyCObject_FromVoidPtr(disp, del_dispersion_model);
-}
-
-
-/**
- * Delete a gaussian dispersion model object
- */
-void del_gaussian_dispersion(void *ptr){
-	GaussianDispersion * disp = static_cast<GaussianDispersion *>(ptr);
-	delete disp;
-	return;
-}
-
-/**
- * Create a gaussian dispersion model as a python object
- */
-PyObject * new_gaussian_dispersion(PyObject *, PyObject *args) {
-	GaussianDispersion *disp = new GaussianDispersion();
-	return PyCObject_FromVoidPtr(disp, del_gaussian_dispersion);
-}
-
-/**
- * Delete an array dispersion model object
- */
-void del_array_dispersion(void *ptr){
-	ArrayDispersion * disp = static_cast<ArrayDispersion *>(ptr);
-	delete disp;
-	return;
-}
-
-/**
- * Create an array dispersion model as a python object
- */
-PyObject * new_array_dispersion(PyObject *, PyObject *args) {
-	ArrayDispersion *disp = new ArrayDispersion();
-	return PyCObject_FromVoidPtr(disp, del_array_dispersion);
-}
-
-#define INVECTOR(obj,buf,len)										\
-    do { \
-        int err = PyObject_AsReadBuffer(obj, (const void **)(&buf), &len); \
-        if (err < 0) return NULL; \
-        len /= sizeof(*buf); \
-    } while (0)
-
-/**
- * Sets weights from a numpy array
- */
-PyObject * set_weights(PyObject *, PyObject *args) {
-	PyObject *val_obj;
-	PyObject *wei_obj;
-	PyObject *disp;
-	Py_ssize_t nval;
-	Py_ssize_t nwei;
-	double *values;
-	double *weights;
-    int i;
-
-	if (!PyArg_ParseTuple(args, "OOO", &disp, &val_obj, &wei_obj)) return NULL;
-	INVECTOR(val_obj, values, nval);
-	INVECTOR(wei_obj, weights, nwei);
-
-	// Sanity check
-	if(nval!=nwei) return NULL;
-
-	// Set the array pointers
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-	dispersion->set_weights(nval, values, weights);
-
-	return Py_BuildValue("i",1);
-}
-
-
-
-/**
- * Define empty module
- */
-static PyMethodDef module_methods[] = {
-	{"new_dispersion_model", (PyCFunction)new_dispersion_model     , METH_VARARGS,
-		  "Create a new DispersionModel object"},
-	{"new_gaussian_model",   (PyCFunction)new_gaussian_dispersion, METH_VARARGS,
-		  "Create a new GaussianDispersion object"},
-	{"new_array_model",      (PyCFunction)new_array_dispersion  , METH_VARARGS,
-		  "Create a new ArrayDispersion object"},
-	{"set_dispersion_weights",(PyCFunction)set_weights  , METH_VARARGS,
-			"Create the dispersion weight arrays for an Array Dispersion object"},
-    {NULL}
-};
-
-
-#ifndef PyMODINIT_FUNC	/* declarations for DLL import/export */
-#define PyMODINIT_FUNC void
-#endif
-PyMODINIT_FUNC
-initc_models(void)
-{
-    PyObject* m;
-
-    m = Py_InitModule3("c_models", module_methods,
-                       "C extension module for SANS scattering models.");
-
-	addCCylinderModel(m);
-	addCCoreShellCylinderModel(m);
-	addCCoreShellModel(m);
-	addCEllipsoidModel(m);
-	addCSphereModel(m);
-	addCEllipticalCylinderModel(m);
-	addDisperser(m);
-	addCGaussian(m);
-	addCLorentzian(m);
-
-}
Index: sansmodels/src/sans/models/c_models/README.txt
===================================================================
--- sansmodels/src/sans/models/c_models/README.txt	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
+++ sansmodels/src/sans/models/c_models/README.txt	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -0,0 +1,24 @@
+NOTE ABOUT THE SANS MODELS REFACTOR [Oct 14, 2008]
+
+This is the new code to implement python extensions for our models.
+
+- The major change here was to create model classes. Parameters
+  are now class objects too, and polydispersity is now part of the
+  parameter definition to speed up computations. See parameters.hh
+  for more details, in particular the definitions of DispersionModel
+  and Parameter.
+
+- Some of the C code that was used to port the IGOR code is still used.
+  For instance, the functions defined in cylinder.c is used in c_models/cylinder.cpp.
+
+- The C++ class are intended to be easily compatible with McVine.
+  
+- The script c_models/WrapperGenerator.py is the script 
+  that was used to generate the python C++ extensions for our models.
+  For instance, CCylinderModel.cpp was created with WrapperGenerator.py run
+  on c_extensions/cylinder.h.
+ 
+- See c_extensions/README.txt for more details about the old c_models.
+
+ 
+  
Index: sansmodels/src/sans/models/c_models/c_models.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/c_models.cpp	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
+++ sansmodels/src/sans/models/c_models/c_models.cpp	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -0,0 +1,154 @@
+/** c_models
+ *
+ * Module containing all SANS model extensions
+ *
+ * @author   M.Doucet / UTK
+ */
+#include <Python.h>
+#include <parameters.hh>
+
+void addCCylinderModel(PyObject *module);
+void addCSphereModel(PyObject *module);
+void addCCoreShellModel(PyObject *module);
+void addCCoreShellCylinderModel(PyObject *module);
+void addCEllipsoidModel(PyObject *module);
+void addCEllipticalCylinderModel(PyObject *module);
+
+extern "C" {
+	//void addCCoreShellCylinderModel(PyObject *module);
+	//void addCCoreShellModel(PyObject *module);
+	//void addCEllipsoidModel(PyObject *module);
+	//void addCSphereModel(PyObject *module);
+	//void addCEllipticalCylinderModel(PyObject *module);
+	void addDisperser(PyObject *module);
+	void addCGaussian(PyObject *module);
+	void addCLorentzian(PyObject *module);
+}
+
+/**
+ * Delete a dispersion model object
+ */
+void del_dispersion_model(void *ptr){
+	DispersionModel * disp = static_cast<DispersionModel *>(ptr);
+	delete disp;
+	return;
+}
+
+/**
+ * Create a dispersion model as a python object
+ */
+PyObject * new_dispersion_model(PyObject *, PyObject *args) {
+	DispersionModel *disp = new DispersionModel();
+	return PyCObject_FromVoidPtr(disp, del_dispersion_model);
+}
+
+
+/**
+ * Delete a gaussian dispersion model object
+ */
+void del_gaussian_dispersion(void *ptr){
+	GaussianDispersion * disp = static_cast<GaussianDispersion *>(ptr);
+	delete disp;
+	return;
+}
+
+/**
+ * Create a gaussian dispersion model as a python object
+ */
+PyObject * new_gaussian_dispersion(PyObject *, PyObject *args) {
+	GaussianDispersion *disp = new GaussianDispersion();
+	return PyCObject_FromVoidPtr(disp, del_gaussian_dispersion);
+}
+
+/**
+ * Delete an array dispersion model object
+ */
+void del_array_dispersion(void *ptr){
+	ArrayDispersion * disp = static_cast<ArrayDispersion *>(ptr);
+	delete disp;
+	return;
+}
+
+/**
+ * Create an array dispersion model as a python object
+ */
+PyObject * new_array_dispersion(PyObject *, PyObject *args) {
+	ArrayDispersion *disp = new ArrayDispersion();
+	return PyCObject_FromVoidPtr(disp, del_array_dispersion);
+}
+
+#define INVECTOR(obj,buf,len)										\
+    do { \
+        int err = PyObject_AsReadBuffer(obj, (const void **)(&buf), &len); \
+        if (err < 0) return NULL; \
+        len /= sizeof(*buf); \
+    } while (0)
+
+/**
+ * Sets weights from a numpy array
+ */
+PyObject * set_weights(PyObject *, PyObject *args) {
+	PyObject *val_obj;
+	PyObject *wei_obj;
+	PyObject *disp;
+	Py_ssize_t nval;
+	Py_ssize_t nwei;
+	double *values;
+	double *weights;
+    int i;
+
+	if (!PyArg_ParseTuple(args, "OOO", &disp, &val_obj, &wei_obj)) return NULL;
+	INVECTOR(val_obj, values, nval);
+	INVECTOR(wei_obj, weights, nwei);
+
+	// Sanity check
+	if(nval!=nwei) return NULL;
+
+	// Set the array pointers
+	void *temp = PyCObject_AsVoidPtr(disp);
+	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
+	dispersion->set_weights(nval, values, weights);
+
+	return Py_BuildValue("i",1);
+}
+
+
+
+/**
+ * Define empty module
+ */
+static PyMethodDef module_methods[] = {
+	{"new_dispersion_model", (PyCFunction)new_dispersion_model     , METH_VARARGS,
+		  "Create a new DispersionModel object"},
+	{"new_gaussian_model",   (PyCFunction)new_gaussian_dispersion, METH_VARARGS,
+		  "Create a new GaussianDispersion object"},
+	{"new_array_model",      (PyCFunction)new_array_dispersion  , METH_VARARGS,
+		  "Create a new ArrayDispersion object"},
+	{"set_dispersion_weights",(PyCFunction)set_weights  , METH_VARARGS,
+			"Create the dispersion weight arrays for an Array Dispersion object"},
+    {NULL}
+};
+
+
+#ifndef PyMODINIT_FUNC	/* declarations for DLL import/export */
+#define PyMODINIT_FUNC void
+#endif
+PyMODINIT_FUNC
+initc_models(void)
+{
+    PyObject* m;
+
+    m = Py_InitModule3("c_models", module_methods,
+                       "C extension module for SANS scattering models.");
+
+	addCCylinderModel(m);
+	addCCoreShellCylinderModel(m);
+	addCCoreShellModel(m);
+	addCEllipsoidModel(m);
+	addCSphereModel(m);
+	addCEllipticalCylinderModel(m);
+	addDisperser(m);
+	addCGaussian(m);
+	addCLorentzian(m);
+
+}
Index: sansmodels/src/sans/models/c_models/modelTemplate.txt
===================================================================
--- sansmodels/src/sans/models/c_models/modelTemplate.txt	(revision af03ddd0932915d6659404ab7824e4223ea2944f)
+++ sansmodels/src/sans/models/c_models/modelTemplate.txt	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -48,7 +48,5 @@
     def clone(self):
         """ Return a identical copy of self """
-        obj = [PYTHONCLASS]()
-        obj.params = copy.deepcopy(self.params)
-        return obj   
+        return self._clone([PYTHONCLASS]())   
    
     def run(self, x = 0.0):
Index: sansmodels/src/sans/models/test/testModel.xml
===================================================================
--- sansmodels/src/sans/models/test/testModel.xml	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
+++ sansmodels/src/sans/models/test/testModel.xml	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -0,0 +1,2 @@
+<Component class='EllipticalCylinderModel' name='EllipticalCylinderModel'>
+</Component>
Index: sansmodels/src/sans/models/test/utest_dispersity.py
===================================================================
--- sansmodels/src/sans/models/test/utest_dispersity.py	(revision ae60f8613faa37cf4fa6112ca8cc43e854b4cdbd)
+++ sansmodels/src/sans/models/test/utest_dispersity.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -47,4 +47,16 @@
         self.assertAlmostEqual(self.model.run(0.001), 4723.32213339, 3)
         self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 4743.56, 2)
+        
+    def test_clone(self):
+        from sans.models.dispersion_models import GaussianDispersion
+        disp = GaussianDispersion()
+        self.model.set_dispersion('radius', disp)
+        self.model.dispersion['radius']['width'] = 5.0
+        self.model.dispersion['radius']['npts'] = 100
+        self.model.setParam('scale', 10.0)
+        
+        new_model = self.model.clone()
+        self.assertAlmostEqual(new_model.run(0.001), 4723.32213339, 3)
+        self.assertAlmostEqual(new_model.runXY([0.001,0.001]), 4743.56, 2)
         
     def test_gaussian_zero(self):
Index: sansmodels/src/sans/models/test/utest_newstylemodels.py
===================================================================
--- sansmodels/src/sans/models/test/utest_newstylemodels.py	(revision ae60f8613faa37cf4fa6112ca8cc43e854b4cdbd)
+++ sansmodels/src/sans/models/test/utest_newstylemodels.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -22,5 +22,5 @@
         return self.params['scale']*x
 
-from sans.models.BaseModel import BaseModel,ParameterProperty
+from sans.models.BaseModel import BaseModel, Parameter, ParameterProperty
 class NewTestModel(BaseModel):
     scale = ParameterProperty('scale')
@@ -31,8 +31,20 @@
         self.parameters['scale'] = Parameter('scale', 4.0) 
         
-    def run(self, x):
+        
+    def runXY(self, x):
         return self.scale*x
         
-
+class TestBogusModel(unittest.TestCase):
+    def setUp(self):
+        self.model = NewTestModel()
+        
+    def test_call(self):
+        self.assertEqual(self.model(1), 4.0)
+        self.model.scale = 1.0
+        self.assertEqual(self.model(1), 1.0)
+        self.model.setParam('scale',2.0)
+        self.assertEqual(self.model(1), 2.0)
+        self.assertEqual(self.model.getParam('scale'), 2.0)
+        
 class TestBaseModel(unittest.TestCase):
     """
@@ -66,8 +78,11 @@
         
         
-        print self.model.parameters
         
         print self.model(0.001)
+        print self.model.parameters['length']
         self.model.setParam("length", 250.0)
+        self.assertEquals(self.model.getParam("length"), 250.0)
+        
+        print self.model.parameters['length']
         print self.model(0.001)
         
Index: sansmodels/src/sans/models/test/utest_nonshape.py
===================================================================
--- sansmodels/src/sans/models/test/utest_nonshape.py	(revision a55fac11c799b1d14d56da351b9543c05fa7afe0)
+++ sansmodels/src/sans/models/test/utest_nonshape.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -130,4 +130,15 @@
         # An exceptio is raised
         self.assertRaises(ZeroDivisionError, self.model.run, 0.0)
+        
+    def test1D_clone(self):
+        value = self._func(50.0, 1.0, 10.0, 2.0)
+        self.model.setParam('background', 10.0)
+        clone = self.model.clone()
+        self.assertEqual(clone.run(2.0), value)
+        self.assertEqual(clone.runXY(2.0), value)
+        
+        # User enter zero as a value of x
+        # An exceptio is raised
+        self.assertRaises(ZeroDivisionError, clone.run, 0.0)
         
     def test2D(self):
Index: sansmodels/src/setup.py
===================================================================
--- sansmodels/src/setup.py	(revision 0f5bc9ff2027432913fd8d2cb067675244acdaf6)
+++ sansmodels/src/setup.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
@@ -92,5 +92,5 @@
     ext_modules = [ Extension("sans_extension.c_models",
      sources = [
-        srcdir+"/c_models.cpp",
+        "sans/models/c_models/c_models.cpp",
         #srcdir+"/CSphereModel.c",
         #srcdir+"/sphere.c",
