Refactor sample selector