change tree to have type and data