new find_best_shifts recursive code