Changed program structure so that MCMC loop reads parsimoniously; heavy-lifting done in functions