pulled isQualified out into its own function