refactored my way of getting samples