Changing the functionality of back button