updated the while loop to desc