Refactor tab tree