Merged back button functionality