modified tree to list