add drawing speedup using max depth