Added state clearing and initialization in the constructor
Sampler now runs without crashing. No guarantee that it gives reasonable answers though.