Refactor tab opening.