currently one big mess, rewrite upcoming
rewrote gate-tree walking algorithm to a more natural output
updates for rewrite