Refactor visit(Term*)