cleaned up treegen code

removed the tons of useless for loops in the tree code, it is now tons faster!!