replace tree.txt with in-code for loop