Refactor on trees for serie 5