Complete runnable version of Gibbs sampling