updating next/prev functionality