need to check differently for visited