Replace the previous depth check with one using a CTE

Created by  quickdudley  on August 22, 2023
N3HHUT2CUKITDQ73WS5XP5S6A3CAM5OUVYDKIZVZXE4DDS77HCIAC
Change contents