Updated back button functionality