Great refactoring for is_variant_of #580