implemented the basic tree methods