complete back-button functionality