move the sampling of priors for minimization to separate method