refactoring of gibbs sampler: splitted into smaller modules & functions