Improved approach of checking superclass.