Finished first draft functionality of bayesian model