Update prev/next button logic