Added printtree and trimdata methods