more refactoring for new visitor