go back to using visitNodes