changed substdata (no longer using list so much easier to handle varialbes). Next need to be able to delete empty goalnode