Added withActiveTab function
Refactoring and fixing lint warnings