add prev button functionality