step2 and 3 create tree