refactoring visitor passing