Refactor same tree