Index: sasmodels/convert.py
===================================================================
--- sasmodels/convert.py	(revision c6ca41e077aa705fcd195f07f143a6daaf729840)
+++ sasmodels/convert.py	(revision ce896fde473387374a3fcfc3918ce7a13676b16c)
@@ -73,4 +73,5 @@
     new model definition end with sld.
     """
+    print "pars",pars
     return dict((p, (v*1e-6 if p.startswith('sld') or p.endswith('sld')
                      else v*1e15 if 'ndensity' in p
Index: sasmodels/generate.py
===================================================================
--- sasmodels/generate.py	(revision d19962c0471a0eee538ce03020b5b226ba2752f6)
+++ sasmodels/generate.py	(revision ce896fde473387374a3fcfc3918ce7a13676b16c)
@@ -192,5 +192,5 @@
 import numpy as np
 
-from .modelinfo import ModelInfo, Parameter, make_parameter_table
+from .modelinfo import ModelInfo, Parameter, make_parameter_table, set_demo
 
 # TODO: identify model files which have changed since loading and reload them.
@@ -539,12 +539,4 @@
     return '\n'.join(source)
 
-def process_parameters(model_info):
-    """
-    Process parameter block, precalculating parameter details.
-    """
-    partable = model_info['parameters']
-    if model_info.get('demo', None) is None:
-        model_info['demo'] = partable.defaults
-
 class CoordinationDetails(object):
     def __init__(self, model_info):
@@ -664,5 +656,5 @@
     if callable(model_info['Iq']) and model_info['Iqxy'] is None:
         partable = model_info['parameters']
-        if partable.type['1d'] != partable.type['2d']:
+        if partable.has_2d:
             raise ValueError("Iqxy model is missing")
         Iq = model_info['Iq']
@@ -735,4 +727,5 @@
         single=getattr(kernel_module, 'single', True),
         structure_factor=getattr(kernel_module, 'structure_factor', False),
+        profile_axes=getattr(kernel_module, 'profile_axes', ['x','y']),
         variant_info=getattr(kernel_module, 'invariant_info', None),
         demo=getattr(kernel_module, 'demo', None),
@@ -742,7 +735,7 @@
         tests=getattr(kernel_module, 'tests', []),
         )
-    process_parameters(model_info)
+    set_demo(model_info, getattr(kernel_module, 'demo', None))
     # Check for optional functions
-    functions = "ER VR form_volume Iq Iqxy shape sesans".split()
+    functions = "ER VR form_volume Iq Iqxy profile sesans".split()
     model_info.update((k, getattr(kernel_module, k, None)) for k in functions)
     create_default_functions(model_info)
Index: sasmodels/modelinfo.py
===================================================================
--- sasmodels/modelinfo.py	(revision d19962c0471a0eee538ce03020b5b226ba2752f6)
+++ sasmodels/modelinfo.py	(revision ce896fde473387374a3fcfc3918ce7a13676b16c)
@@ -45,7 +45,7 @@
     if isinstance(limits, list) and all(isstr(k) for k in limits):
         choices = limits
-        limits = [1, len(choices)]
+        limits = [0, len(choices)-1]
     else:
-        choices = None
+        choices = []
     # TODO: maybe allow limits of None for (-inf, inf)
     try:
@@ -115,4 +115,48 @@
     return parameter
 
+
+def set_demo(model_info, demo):
+    """
+    Assign demo parameters to model_info['demo']
+
+    If demo is not defined, then use defaults.
+
+    If demo is defined, override defaults with value from demo.
+
+    If demo references vector fields, such as thickness[n], then support
+    different ways of assigning the demo values, including assigning a
+    specific value (e.g., thickness3=50.0), assigning a new value to all
+    (e.g., thickness=50.0) or assigning values using list notation.
+    """
+    partable = model_info['parameters']
+    if demo is None:
+        result = partable.defaults
+    else:
+        pars = dict((p.id, p) for p in partable.kernel_parameters)
+        result = partable.defaults.copy()
+        vectors = dict((name,value) for name,value in demo.items()
+                       if name in pars and pars[name].length > 1)
+        if vectors:
+            scalars = dict((name, value) for name, value in demo.items()
+                           if name not in pars or pars[name].length == 1)
+            for name, value in vectors.items():
+                if np.isscalar(value):
+                    # support for the form
+                    #    demo(thickness=0, thickness2=50)
+                    for k in pars[name].length:
+                        key = name+str(k)
+                        if key not in scalars:
+                            scalars[key] = vectors
+                else:
+                    # supoprt for the form
+                    #    demo(thickness=[20,10,3])
+                    for (k,v) in enumerate(value):
+                        scalars[name+str(k)] = v
+            result.update(scalars)
+        else:
+            result.update(demo)
+
+    model_info['demo'] = result
+
 class Parameter(object):
     """
@@ -171,5 +215,4 @@
         self.type = type
         self.description = description
-        self.choices = None
 
         # Length and length_control will be filled in once the complete
@@ -182,4 +225,7 @@
         self.polydisperse = False
         self.relative_pd = False
+
+        # choices are also set externally.
+        self.choices = []
 
     def as_definition(self):
Index: sasmodels/models/onion.c
===================================================================
--- sasmodels/models/onion.c	(revision fdb148728a4d4bdcb4cd711d87631f3ee41993fd)
+++ sasmodels/models/onion.c	(revision ce896fde473387374a3fcfc3918ce7a13676b16c)
@@ -4,5 +4,5 @@
     double thickness, double A)
 {
-  const double vol = 4.0/3.0 * M_PI * r * r * r;
+  const double vol = M_4PI_3 * cube(r);
   const double qr = q * r;
   const double alpha = A * r/thickness;
@@ -19,5 +19,5 @@
     double sinqr, cosqr;
     SINCOS(qr, sinqr, cosqr);
-    fun = -3.0(
+    fun = -3.0*(
             ((alphasq - qrsq)*sinqr/qr - 2.0*alpha*cosqr) / sumsq
                 - (alpha*sinqr/qr - cosqr)
@@ -32,5 +32,5 @@
 f_linear(double q, double r, double sld, double slope)
 {
-  const double vol = 4.0/3.0 * M_PI * r * r * r;
+  const double vol = M_4PI_3 * cube(r);
   const double qr = q * r;
   const double bes = sph_j1c(qr);
@@ -52,5 +52,5 @@
 {
   const double bes = sph_j1c(q * r);
-  const double vol = 4.0/3.0 * M_PI * r * r * r;
+  const double vol = M_4PI_3 * cube(r);
   return sld * vol * bes;
 }
@@ -64,15 +64,15 @@
     r += thickness[i];
   }
-  return 4.0/3.0 * M_PI * r * r * r;
+  return M_4PI_3*cube(r);
 }
 
 static double
-Iq(double q, double core_sld, double core_radius, double solvent_sld,
-    double n, double in_sld[], double out_sld[], double thickness[],
+Iq(double q, double sld_core, double core_radius, double sld_solvent,
+    double n, double sld_in[], double sld_out[], double thickness[],
     double A[])
 {
   int i;
-  r = core_radius;
-  f = f_constant(q, r, core_sld);
+  double r = core_radius;
+  double f = f_constant(q, r, sld_core);
   for (i=0; i<n; i++){
     const double r0 = r;
@@ -92,6 +92,6 @@
     }
   }
-  f -= f_constant(q, r, solvent_sld);
-  f2 = f * f * 1.0e-4;
+  f -= f_constant(q, r, sld_solvent);
+  const double f2 = f * f * 1.0e-4;
 
   return f2;
Index: sasmodels/models/onion.py
===================================================================
--- sasmodels/models/onion.py	(revision 6a8fdfe497ace4a16ba0ab4b8bb00a726a419103)
+++ sasmodels/models/onion.py	(revision ce896fde473387374a3fcfc3918ce7a13676b16c)
@@ -292,15 +292,15 @@
 
 #             ["name", "units", default, [lower, upper], "type","description"],
-parameters = [["core_sld", "1e-6/Ang^2", 1.0, [-inf, inf], "",
+parameters = [["sld_core", "1e-6/Ang^2", 1.0, [-inf, inf], "",
                "Core scattering length density"],
-              ["core_radius", "Ang", 200., [0, inf], "",
+              ["core_radius", "Ang", 200., [0, inf], "volume",
                "Radius of the core"],
-              ["solvent_sld", "1e-6/Ang^2", 6.4, [-inf, inf], "",
+              ["sld_solvent", "1e-6/Ang^2", 6.4, [-inf, inf], "",
                "Solvent scattering length density"],
               ["n", "", 1, [0, 10], "volume",
                "number of shells"],
-              ["in_sld[n]", "1e-6/Ang^2", 1.7, [-inf, inf], "",
+              ["sld_in[n]", "1e-6/Ang^2", 1.7, [-inf, inf], "",
                "scattering length density at the inner radius of shell k"],
-              ["out_sld[n]", "1e-6/Ang^2", 2.0, [-inf, inf], "",
+              ["sld_out[n]", "1e-6/Ang^2", 2.0, [-inf, inf], "",
                "scattering length density at the outer radius of shell k"],
               ["thickness[n]", "Ang", 40., [0, inf], "volume",
@@ -310,14 +310,11 @@
               ]
 
-#source = ["lib/sph_j1c.c", "onion.c"]
-
-def Iq(q, *args, **kw):
-    return q
-
-def Iqxy(qx, *args, **kw):
-    return qx
-
-
-def shape(core_sld, core_radius, solvent_sld, n, in_sld, out_sld, thickness, A):
+source = ["lib/sph_j1c.c", "onion.c"]
+
+#def Iq(q, *args, **kw):
+#    return q
+
+profile_axes = ['Radius (A)', 'SLD (1e-6/A^2)']
+def profile(core_sld, core_radius, solvent_sld, n, in_sld, out_sld, thickness, A):
     """
     SLD profile
@@ -373,10 +370,10 @@
 
 demo = {
-    "solvent_sld": 2.2,
-    "core_sld": 1.0,
+    "sld_solvent": 2.2,
+    "sld_core": 1.0,
     "core_radius": 100,
     "n": 4,
-    "in_sld": [0.5, 1.5, 0.9, 2.0],
-    "out_sld": [nan, 0.9, 1.2, 1.6],
+    "sld_in": [0.5, 1.5, 0.9, 2.0],
+    "sld_out": [nan, 0.9, 1.2, 1.6],
     "thickness": [50, 75, 150, 75],
     "A": [0, -1, 1e-4, 1],
Index: sasmodels/models/spherical_sld.py
===================================================================
--- sasmodels/models/spherical_sld.py	(revision e42b0b97594cafef1369a17613a32c7f8885d6ec)
+++ sasmodels/models/spherical_sld.py	(revision ce896fde473387374a3fcfc3918ce7a13676b16c)
@@ -163,158 +163,155 @@
 title = "Sperical SLD intensity calculation"
 description = """
-            I(q) =
-               background = Incoherent background [1/cm]
-        """
+    I(q) =
+    background = Incoherent background [1/cm]
+    """
 category = "sphere-based"
 
 # pylint: disable=bad-whitespace, line-too-long
 #            ["name", "units", default, [lower, upper], "type", "description"],
-parameters = [["n_shells",         "",               1,      [0, 9],         "", "number of shells"],
-              ["thick_inter[n]",   "Ang",            50,     [-inf, inf],    "", "intern layer thickness"],
-              ["func_inter[n]",    "",               0,      [0, 4],         "", "Erf:0, RPower:1, LPower:2, RExp:3, LExp:4"],
-              ["sld_core",         "1e-6/Ang^2",     2.07,   [-inf, inf],    "", "sld function flat"],
-              ["sld_solvent",      "1e-6/Ang^2",     1.0,    [-inf, inf],    "", "sld function solvent"],
-              ["sld_flat[n]",      "1e-6/Ang^2",     4.06,   [-inf, inf],    "", "sld function flat"],
-              ["thick_inter[n]",   "Ang",            50.0,   [0, inf],    "", "intern layer thickness"],
-              ["thick_flat[n]",    "Ang",            100.0,  [0, inf],    "", "flat layer_thickness"],
-              ["inter_nu[n]",      "",               2.5,    [-inf, inf],    "", "steepness parameter"],
-              ["npts_inter",       "",               35,     [0, 35],        "", "number of points in each sublayer Must be odd number"],
-              ["core_rad",         "Ang",            50.0,   [0, inf],    "", "intern layer thickness"],
+parameters = [["n_shells",                "",               1,      [0, 9],      "", "number of shells"],
+              ["thick_inter[n_shells]",   "Ang",            50,     [-inf, inf], "", "intern layer thickness"],
+              ["func_inter[n_shells]",    "",               0,      [0, 4],      "", "Erf:0, RPower:1, LPower:2, RExp:3, LExp:4"],
+              ["sld_core",                "1e-6/Ang^2",     2.07,   [-inf, inf], "", "sld function flat"],
+              ["sld_solvent",             "1e-6/Ang^2",     1.0,    [-inf, inf], "", "sld function solvent"],
+              ["sld_flat[n_shells]",      "1e-6/Ang^2",     4.06,   [-inf, inf], "", "sld function flat"],
+              ["thick_inter[n_shells]",   "Ang",            50.0,   [0, inf],    "", "intern layer thickness"],
+              ["thick_flat[n_shells]",    "Ang",            100.0,  [0, inf],    "", "flat layer_thickness"],
+              ["inter_nu[n_shells]",      "",               2.5,    [-inf, inf], "", "steepness parameter"],
+              ["npts_inter",              "",               35,     [0, 35],     "", "number of points in each sublayer Must be odd number"],
+              ["core_rad",                "Ang",            50.0,   [0, inf],    "", "intern layer thickness"],
               ]
 # pylint: enable=bad-whitespace, line-too-long
+
 #source = ["lib/librefl.c",  "lib/sph_j1c.c", "spherical_sld.c"]
-
 def Iq(q, *args, **kw):
     return q
 
-def Iqxy(qx, *args, **kw):
-    return qx
-
-
 demo = dict(
-        n_shells=4,
-        scale=1.0,
-        solvent_sld=1.0,
-        background=0.0,
-        npts_inter=35.0,
-        func_inter_0=0,
-        nu_inter_0=2.5,
-        rad_core_0=50.0,
-        core0_sld=2.07,
-        thick_inter_0=50.0,
-        func_inter_1=0,
-        nu_inter_1=2.5,
-        thick_inter_1=50.0,
-        flat1_sld=4.0,
-        thick_flat_1=100.0,
-        func_inter_2=0,
-        nu_inter_2=2.5,
-        thick_inter_2=50.0,
-        flat2_sld=3.5,
-        thick_flat_2=100.0,
-        func_inter_3=0,
-        nu_inter_3=2.5,
-        thick_inter_3=50.0,
-        flat3_sld=4.0,
-        thick_flat_3=100.0,
-        func_inter_4=0,
-        nu_inter_4=2.5,
-        thick_inter_4=50.0,
-        flat4_sld=3.5,
-        thick_flat_4=100.0,
-        func_inter_5=0,
-        nu_inter_5=2.5,
-        thick_inter_5=50.0,
-        flat5_sld=4.0,
-        thick_flat_5=100.0,
-        func_inter_6=0,
-        nu_inter_6=2.5,
-        thick_inter_6=50.0,
-        flat6_sld=3.5,
-        thick_flat_6=100.0,
-        func_inter_7=0,
-        nu_inter_7=2.5,
-        thick_inter_7=50.0,
-        flat7_sld=4.0,
-        thick_flat_7=100.0,
-        func_inter_8=0,
-        nu_inter_8=2.5,
-        thick_inter_8=50.0,
-        flat8_sld=3.5,
-        thick_flat_8=100.0,
-        func_inter_9=0,
-        nu_inter_9=2.5,
-        thick_inter_9=50.0,
-        flat9_sld=4.0,
-        thick_flat_9=100.0,
-        func_inter_10=0,
-        nu_inter_10=2.5,
-        thick_inter_10=50.0,
-        flat10_sld=3.5,
-        thick_flat_10=100.0
-        )
+    n_shells=4,
+    scale=1.0,
+    solvent_sld=1.0,
+    background=0.0,
+    npts_inter=35.0,
+    func_inter_0=0,
+    nu_inter_0=2.5,
+    rad_core_0=50.0,
+    core0_sld=2.07,
+    thick_inter_0=50.0,
+    func_inter_1=0,
+    nu_inter_1=2.5,
+    thick_inter_1=50.0,
+    flat1_sld=4.0,
+    thick_flat_1=100.0,
+    func_inter_2=0,
+    nu_inter_2=2.5,
+    thick_inter_2=50.0,
+    flat2_sld=3.5,
+    thick_flat_2=100.0,
+    func_inter_3=0,
+    nu_inter_3=2.5,
+    thick_inter_3=50.0,
+    flat3_sld=4.0,
+    thick_flat_3=100.0,
+    func_inter_4=0,
+    nu_inter_4=2.5,
+    thick_inter_4=50.0,
+    flat4_sld=3.5,
+    thick_flat_4=100.0,
+    func_inter_5=0,
+    nu_inter_5=2.5,
+    thick_inter_5=50.0,
+    flat5_sld=4.0,
+    thick_flat_5=100.0,
+    func_inter_6=0,
+    nu_inter_6=2.5,
+    thick_inter_6=50.0,
+    flat6_sld=3.5,
+    thick_flat_6=100.0,
+    func_inter_7=0,
+    nu_inter_7=2.5,
+    thick_inter_7=50.0,
+    flat7_sld=4.0,
+    thick_flat_7=100.0,
+    func_inter_8=0,
+    nu_inter_8=2.5,
+    thick_inter_8=50.0,
+    flat8_sld=3.5,
+    thick_flat_8=100.0,
+    func_inter_9=0,
+    nu_inter_9=2.5,
+    thick_inter_9=50.0,
+    flat9_sld=4.0,
+    thick_flat_9=100.0,
+    func_inter_10=0,
+    nu_inter_10=2.5,
+    thick_inter_10=50.0,
+    flat10_sld=3.5,
+    thick_flat_10=100.0
+    )
 
 oldname = "SphereSLDModel"
 oldpars = dict(
-        n_shells="n_shells",
-        scale="scale",
-        npts_inter='npts_inter',
-        solvent_sld='sld_solv',
-        func_inter_0='func_inter0',
-        nu_inter_0='nu_inter0',
-        background='background',
-        rad_core_0='rad_core0',
-        core0_sld='sld_core0',
-        thick_inter_0='thick_inter0',
-        func_inter_1='func_inter1',
-        nu_inter_1='nu_inter1',
-        thick_inter_1='thick_inter1',
-        flat1_sld='sld_flat1',
-        thick_flat_1='thick_flat1',
-        func_inter_2='func_inter2',
-        nu_inter_2='nu_inter2',
-        thick_inter_2='thick_inter2',
-        flat2_sld='sld_flat2',
-        thick_flat_2='thick_flat2',
-        func_inter_3='func_inter3',
-        nu_inter_3='nu_inter3',
-        thick_inter_3='thick_inter3',
-        flat3_sld='sld_flat3',
-        thick_flat_3='thick_flat3',
-        func_inter_4='func_inter4',
-        nu_inter_4='nu_inter4',
-        thick_inter_4='thick_inter4',
-        flat4_sld='sld_flat4',
-        thick_flat_4='thick_flat4',
-        func_inter_5='func_inter5',
-        nu_inter_5='nu_inter5',
-        thick_inter_5='thick_inter5',
-        flat5_sld='sld_flat5',
-        thick_flat_5='thick_flat5',
-        func_inter_6='func_inter6',
-        nu_inter_6='nu_inter6',
-        thick_inter_6='thick_inter6',
-        flat6_sld='sld_flat6',
-        thick_flat_6='thick_flat6',
-        func_inter_7='func_inter7',
-        nu_inter_7='nu_inter7',
-        thick_inter_7='thick_inter7',
-        flat7_sld='sld_flat7',
-        thick_flat_7='thick_flat7',
-        func_inter_8='func_inter8',
-        nu_inter_8='nu_inter8',
-        thick_inter_8='thick_inter8',
-        flat8_sld='sld_flat8',
-        thick_flat_8='thick_flat8',
-        func_inter_9='func_inter9',
-        nu_inter_9='nu_inter9',
-        thick_inter_9='thick_inter9',
-        flat9_sld='sld_flat9',
-        thick_flat_9='thick_flat9',
-        func_inter_10='func_inter10',
-        nu_inter_10='nu_inter10',
-        thick_inter_10='thick_inter10',
-        flat10_sld='sld_flat10',
-        thick_flat_10='thick_flat10')
+    n_shells="n_shells",
+    scale="scale",
+    background='background',
+    npts_inter='npts_inter',
+    solvent_sld='sld_solv',
+
+    func_inter_0='func_inter0',
+    nu_inter_0='nu_inter0',
+    rad_core_0='rad_core0',
+    core0_sld='sld_core0',
+    thick_inter_0='thick_inter0',
+    func_inter_1='func_inter1',
+    nu_inter_1='nu_inter1',
+    thick_inter_1='thick_inter1',
+    flat1_sld='sld_flat1',
+    thick_flat_1='thick_flat1',
+    func_inter_2='func_inter2',
+    nu_inter_2='nu_inter2',
+    thick_inter_2='thick_inter2',
+    flat2_sld='sld_flat2',
+    thick_flat_2='thick_flat2',
+    func_inter_3='func_inter3',
+    nu_inter_3='nu_inter3',
+    thick_inter_3='thick_inter3',
+    flat3_sld='sld_flat3',
+    thick_flat_3='thick_flat3',
+    func_inter_4='func_inter4',
+    nu_inter_4='nu_inter4',
+    thick_inter_4='thick_inter4',
+    flat4_sld='sld_flat4',
+    thick_flat_4='thick_flat4',
+    func_inter_5='func_inter5',
+    nu_inter_5='nu_inter5',
+    thick_inter_5='thick_inter5',
+    flat5_sld='sld_flat5',
+    thick_flat_5='thick_flat5',
+    func_inter_6='func_inter6',
+    nu_inter_6='nu_inter6',
+    thick_inter_6='thick_inter6',
+    flat6_sld='sld_flat6',
+    thick_flat_6='thick_flat6',
+    func_inter_7='func_inter7',
+    nu_inter_7='nu_inter7',
+    thick_inter_7='thick_inter7',
+    flat7_sld='sld_flat7',
+    thick_flat_7='thick_flat7',
+    func_inter_8='func_inter8',
+    nu_inter_8='nu_inter8',
+    thick_inter_8='thick_inter8',
+    flat8_sld='sld_flat8',
+    thick_flat_8='thick_flat8',
+    func_inter_9='func_inter9',
+    nu_inter_9='nu_inter9',
+    thick_inter_9='thick_inter9',
+    flat9_sld='sld_flat9',
+    thick_flat_9='thick_flat9',
+    func_inter_10='func_inter10',
+    nu_inter_10='nu_inter10',
+    thick_inter_10='thick_inter10',
+    flat10_sld='sld_flat10',
+    thick_flat_10='thick_flat10')
 
 #TODO: Not working yet
Index: sasmodels/product.py
===================================================================
--- sasmodels/product.py	(revision 8e0d974c44c6bf60f95c3ad8c308c4d0b1399656)
+++ sasmodels/product.py	(revision ce896fde473387374a3fcfc3918ce7a13676b16c)
@@ -14,5 +14,4 @@
 
 from .core import call_ER_VR
-from .generate import process_parameters
 
 SCALE=0
@@ -64,5 +63,4 @@
     model_info['oldpars'] = oldpars
     model_info['composition'] = ('product', [p_info, s_info])
-    process_parameters(model_info)
     return model_info
 
Index: sasmodels/sasview_model.py
===================================================================
--- sasmodels/sasview_model.py	(revision 787be866d11d3e33f22f7b4ac9d0ee1a15146903)
+++ sasmodels/sasview_model.py	(revision ce896fde473387374a3fcfc3918ce7a13676b16c)
@@ -32,8 +32,4 @@
 
     Returns a class that can be used directly as a sasview model.t
-
-    Defaults to using the new name for a model.  Setting
-    *namestyle='oldname'* will produce a class with a name
-    compatible with SasView.
     """
     model_info = core.load_model_info(model_name)
@@ -58,11 +54,19 @@
         self._kernel = None
         model_info = self._model_info
+        parameters = model_info['parameters']
 
         self.name = model_info['name']
-        self.oldname = model_info['oldname']
         self.description = model_info['description']
         self.category = None
-        self.multiplicity_info = None
-        self.is_multifunc = False
+        #self.is_multifunc = False
+        for p in parameters.kernel_parameters:
+            if p.is_control:
+                profile_axes = model_info['profile_axes']
+                self.multiplicity_info = [
+                    p.limits[1], p.name, p.choices, profile_axes[0]
+                    ]
+                break
+        else:
+            self.multiplicity_info = []
 
         ## interpret the parameters
