implemented gregory posteriors