Apparently using stacks is faster than arrays.