refactored has_membership method