Coded bayesian trial model. Still incomplete.