Now two arguments: depth and maximum number of repetitions