State machine for bayesian functionality