Refactored type check to be consistent between classes.