Finalizing back button functionality