Removed the stack thing entirely and used recursion instead.