added proper tree creation