going to previous popup will also now check for the available previous index rather than just decrementing 1