sorting w/tree