Max depth is used after sorting