Refactor of samplers code

Sampler code has been broken into smaller parts.
It has been cleaned up in general.