working on visit function