improvement to the order in which nodes are printed