visitor and resolve refactoring