updated functions with mcmc length and template