Some refactorings and made TyTree construction and filtering lazier.