update functionality of links next and prev