Tgbranch

There is also a "writerows" method that can simplify this code a bit.