Updated lastVisit Logic