recursive max depth