modified to use the 'get_parent_class' rather than 'instanceof'