Updated the back button functionality