major refactor.  Got away from using a tree when I could use a stack instead