adding code for saving current tab.