Added working previous button functionality