it will be great to have also a depth parameter that will limit the number of level that we will consider in the hierarchy