Cleaning up conditional logic for version matching/selection

+review REVIEW-5224