Dynamic tree implementation