modify code to process only the active tab's data