back button functionality perfected