Move sampling functionality to new class