refactored findCodeVariants to extract method hasVariant