Revert commit 8cc38b4 and proper fixes

Revert commit 8cc38b4 and proper fix for tab re-selection and separate the code in 2 lines to make it a bit more readable as jpardogo comment