Working Gibbs Sampling code