Index: sasmodels/models/spherical_sld.c
===================================================================
--- sasmodels/models/spherical_sld.c	(revision eb97b11aadaf88044ec058d0176aacaaca44500d)
+++ sasmodels/models/spherical_sld.c	(revision 4605bf1077c64b6b94c663f1aa5c000e7f260e0c)
@@ -1,42 +1,12 @@
-//Headers
-static double form_volume(double thick_inter[],
-    double thick_flat_[],
-    double core_radius,
-    int n_shells);
-
-static double Iq(double q,
+static double form_volume(
     int n_shells,
-    double thick_inter[],
-    double func_inter[],
-    double sld_core,
-    double sld_solvent,
-    double sld_flat[],
+    double radius_core,
     double thick_flat[],
-    double nu_inter[],
-    int npts_inter,
-    double core_radius);
-
-static double Iqxy(double qx, double qy,
-    int n_shells,
-    double thick_inter[],
-    double func_inter[],
-    double sld_core,
-    double sld_solvent,
-    double sld_flat[],
-    double thick_flat[],
-    double nu_inter[],
-    int npts_inter,
-    double core_radius);
-
-//Main code
-static double form_volume(double thick_inter[],
-    double thick_flat_[],
-    double core_radius,
-    int n)
+    double thick_inter[])
 {
     double radius = 0.0;
     int i;
-    double r = core_radius;
-    for (i=0; i < n; i++) {
+    double r = radius_core;
+    for (i=0; i < n_shells; i++) {
         r += thick_inter[i];
         r += thick_flat[i];
@@ -191,13 +161,5 @@
     }
   }
-  //vol += vol_sub;
   f2 = f * f / vol;
-  //f2 *= scale;
-  //f2 += background;
-  //free(fun_type);
-  //free(sld);
-  //free(thick_inter);
-  //free(thick);
-  //free(fun_coef);
 
   return (f2);
@@ -210,31 +172,30 @@
  * @return: function value
  */
-double Iq(double q,
+static double Iq(double q,
     int n_shells,
-    double thick_inter[],
-    double func_inter[],
+    int npts_inter,
+    double radius_core,
     double sld_core,
     double sld_solvent,
     double sld_flat[],
     double thick_flat[],
-    double nu_inter[],
-    int npts_inter,
-    double core_radius
-    ) {
+    double func_inter[],
+    double thick_inter[],
+    double nu_inter[] ) {
 
     //printf("Number of points %d\n",npts_inter);
     double intensity;
-    //TODO: Remove this container at later stage. It is only kept to minimize stupid errors now
+    //TODO: Remove this container at later stage.
     double dp[60];
     dp[0] = n_shells;
     //This is scale will also have to be removed at some stage
     dp[1] = 1.0;
-    dp[2] = thick_inter_0;
-    dp[3] = func_inter_0;
+    dp[2] = thick_inter[0];
+    dp[3] = func_inter[0];
     dp[4] = sld_core;
     dp[5] = sld_solvent;
     dp[6] = 0.0;
 
-    for (i=0; i<n; i++){
+    for (int i=1; i<n_shells; i++){
         dp[i+7] = sld_flat[i];
         dp[i+17] = thick_inter[i];
@@ -245,6 +206,6 @@
 
     dp[57] = npts_inter;
-    dp[58] = nu_inter_0;
-    dp[59] = rad_core_0;
+    dp[58] = nu_inter[0];
+    dp[59] = radius_core;
 
     intensity = 1.0e-4*sphere_sld_kernel(dp,q);
@@ -259,21 +220,21 @@
  * @return: function value
  */
-double Iqxy(double qx, double qy,
+
+/*static double Iqxy(double qx, double qy,
     int n_shells,
-    double thick_inter[],
-    double func_inter[],
+    int npts_inter,
+    double radius_core
     double sld_core,
     double sld_solvent,
     double sld_flat[],
     double thick_flat[],
+    double func_inter[],
+    double thick_inter[],
     double nu_inter[],
-    int npts_inter,
-    double core_radius
     ) {
 
     double q = sqrt(qx*qx + qy*qy);
-    return Iq(q, n_shells, thick_inter[], func_inter[], sld_core, sld_solvent,
-    sld_flat[], thick_flat[],nu_inter[], npts_inter, core_radius)
-
-}
-
+    return Iq(q, n_shells, npts_inter, radius_core, sld_core, sld_solvent,
+    sld_flat[], thick_flat[], func_inter[], thick_inter[], nu_inter[])
+}*/
+
Index: sasmodels/models/spherical_sld.py
===================================================================
--- sasmodels/models/spherical_sld.py	(revision eb97b11aadaf88044ec058d0176aacaaca44500d)
+++ sasmodels/models/spherical_sld.py	(revision 4605bf1077c64b6b94c663f1aa5c000e7f260e0c)
@@ -171,13 +171,13 @@
 #            ["name", "units", default, [lower, upper], "type", "description"],
 parameters = [["n_shells",                "",               1,      [0, 9],         "", "number of shells"],
+              ["npts_inter",       "",               35,     [0, 35],        "", "number of points in each sublayer Must be odd number"],
               ["radius_core",      "Ang",            50.0,   [0, inf],       "", "intern layer thickness"],
               ["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_flat[n]",    "Ang",            100.0,  [0, inf],       "", "flat layer_thickness"],
-              ["func_inter[n]",    "",               0,      [0, 4],         "", "Erf:0, RPower:1, LPower:2, RExp:3, LExp:4"],
-              ["thick_inter[n]",   "Ang",            50.0,   [0, inf],       "", "intern layer thickness"],
-              ["nu_inter[n]",      "",               2.5,    [-inf, inf],    "", "steepness parameter"],
-              ["npts_inter",       "",               35,     [0, 35],        "", "number of points in each sublayer Must be odd number"],
+              ["sld_flat[n_shells]",      "1e-6/Ang^2",     4.06,   [-inf, inf],    "", "sld function flat"],
+              ["thick_flat[n_shells]",    "Ang",            100.0,  [0, inf],       "", "flat layer_thickness"],
+              ["func_inter[n_shells]",    "",               0,      [0, 4],         "", "Erf:0, RPower:1, LPower:2, RExp:3, LExp:4"],
+              ["thick_inter[n_shells]",   "Ang",            50.0,   [0, inf],       "", "intern layer thickness"],
+              ["nu_inter[n_shells]",      "",               2.5,    [-inf, inf],    "", "steepness parameter"],
               ]
 # pylint: enable=bad-whitespace, line-too-long
@@ -195,7 +195,4 @@
     Returns shape profile with x=radius, y=SLD.
     """
-
-    #total_radius = 1.25*(sum(thickness[:n_shells]) + core_radius + 1)
-    #dr = total_radius/400  # 400 points for a smooth plot
 
     z = []
@@ -220,33 +217,32 @@
                     # shift half sub thickness for the first point
                     z0 -= dz#/2.0
-                        z.append(z0)
-                        #z0 -= dz/2.0
-                        z0 += thick_flat[i]
-                        sld_i = sld_flat[i]
-                        beta.append(sld_flat[i])
-                        dz = 0
+                    z.append(z0)
+                    #z0 -= dz/2.0
+                    z0 += thick_flat[i]
+                    sld_i = sld_flat[i]
+                    beta.append(sld_flat[i])
+                    dz = 0
+                else:
+                    nu = nu_inter[i-1]
+                    # decide which sld is which, sld_r or sld_l
+                    if i == 1:
+                        sld_l = sld_core
                     else:
-                        nu = nu_inter[i-1]
-                        # decide which sld is which, sld_r or sld_l
-                        if i == 1:
-                            sld_l = sld_core
-                        else:
-                            sld_l = sld_flat[i-1]
-                        if i == n_shells+1:
-                            sld_r = sld_solvent
-                        else:
-                            sld_r = sld_flat[i]
-                        # get function type
-                        func_idx = func_inter[i-1]
-                        # calculate the sld
-                        sld_i = intersldfunc(func_idx, npts_inter, n_s, nu,
+                        sld_l = sld_flat[i-1]
+                    if i == n_shells+1:
+                        sld_r = sld_solvent
+                    else:
+                        sld_r = sld_flat[i]
+                    # get function type
+                    func_idx = func_inter[i-1]
+                    # calculate the sld
+                    sld_i = intersldfunc(func_idx, npts_inter, n_s, nu,
                                             sld_l, sld_r)
-                    # append to the list
-                    z.append(z0)
-                    beta.append(sld_i)
-                    z0 += dz
-                    if j == 1:
-                        break
-    # put sld of solvent
+                # append to the list
+                z.append(z0)
+                beta.append(sld_i)
+                z0 += dz
+                if j == 1:
+                    break
     z.append(z0)
     beta.append(sld_solvent)
@@ -255,5 +251,4 @@
     beta.append(sld_solvent)
     # return sld profile (r, beta)
-    
     return np.asarray(z), np.asarray(beta)*1e-6
 
@@ -268,5 +263,5 @@
     n=4,
     scale=1.0,
-    solvent_sld=1.0,
+    sld_solvent=1.0,
     background=0.0,
     npts_inter=35.0,
