update to process next and previous links