I hope is ok that I used the recursive version,and not the one from class