Refactor new tab creation