implementing go back function