Feature/mcmc writer

@syclik 

Reopening pull request of mcmc_writer into development branch.  Current development branch merged.