         double logdens_prop = logdens_meas + logdens_pop;
         
         // Compute the Metropolis ratio
-        double ratio = logdens_prop - logdens[i];
+        double ratio = logdens_prop - logdens[i] - logdens_meas;
         ratio = (ratio < 0.0) ? ratio : 0.0;
         ratio = exp(ratio);
+        
+        p_mha_ratio[i] = ratio;
         
         // Now randomly decide whether to accept or reject
         double unif_draw = curand_uniform_double(&localState);

            for (int k=0; k<(j+1); k++) {
                // transform the unit proposal to the centered proposal, drawn from a multivariate normal
                // or t-distribution.
                scaled_proposal_j += cholfactor[cholfact_index] * snorm_deviate[j];
                cholfact_index++;
            }
            new_chi[j] = chi[j] + scaled_proposal_j;
            scaled_proposal[j] = scaled_proposal_j;
        }

// Perform the MHA update on the n characteristics, done in parallel on the GPU.
__global__
void update_chi(double* chi, double* meas, double* meas_unc, int n, double* logdens, double* prop_cholfact,
                curandState* state, int current_iter, double* p_mha_ratio)
{
	int i = blockDim.x * blockIdx.x + threadIdx.x;
	if (i < n)
