added back button handling