changing tree from struct to class