added maxdepth and average depth