Got gibbs sampler working

It's very slow; especially on the first iteration. I haven't made
any efforts to optimize it, so low-hanging fruit are certainly there.
Modified to use gibbs sampler