shouldVisit method has been refactored