Updated with unit tests for Sampler