Refactoring ReplVisitor