Added back button handling