change return type of reverse function. Need to recover the last elemen to be able to iterate on the list