First working version of the sampler. No resume yet.