Reduce algorithmic complexity of is_superclass