tree implementation completed