reworking CloenTree() and split()