Prev function

Updated prev function