working code for MCMC sampling, though poor convergence