small refactoring and set initial tab to correct