Added some descendant/ancestor determination for entities.