Added max depth checks to users and groups