added goto next and goto prev into the rewrite