Add toggle and redirect to previous URL functionality.