sample collection refactor