Added prev/next logic and peek function