implemented some tree operations