             for (int k=0; k<(j+1); k++) {
                 // transform the unit proposal to the centered proposal, drawn from a multivariate normal
                 // or t-distribution.
-                centered_proposal += cholfactor[n * cholfact_index + i] * snorm_deviate[j];
-                cholfact_index++
+                centered_proposal += cholfactor[cholfact_index] * snorm_deviate[j];
+                cholfact_index++;
             }
             new_chi[i] = chi[i] + centered_proposal;
         }
 
         // Compute the conditional log-posterior of the proposed parameter values for this data point
-        double meas_i[c_m]
-        double meas_unc_i[c_m]
+        double meas_i[c_m];
+        double meas_unc_i[c_m];
         for (int k=0; k<c_m; k++) {
             // grab the measurements for this data point
             meas_i[k] = meas[n * k + i];

{
    // Random number generator and distribution needed to simulate some data
	// unsigned int seed = 98724732;
    unsigned int seed =123455;
	static thrust::minstd_rand rng(seed);
	thrust::random::experimental::normal_distribution<double> snorm(0., 1.0);
    thrust::random::uniform_real_distribution<double> uniform(0.0, 1.0);

    // Cholesky factor of proposal distribution for each data point, used by the Metropolis algorithm. The proposal
    // covariance matrix for each data point is Covar_i = PropChol_i * transpose(PropChol_i).
    dim_cholfactor = p * p - ((p - 1) * p) / 2; // cholesky factor is a lower-diagonal matrix
    thrust::host_vector<double> h_prop_cholfact(n * dim_cholfactor);
    thrust::fill(h_prop_cholfact.begin(), h_prop_cholfact.end(), 0.0);
    
	// Create simulated characteristics and data
