switched from array to structure for node tree