Rewrite of prevnext snippet.