refactor pick logic