Should we ever need it, here is the improved sampler code