Updated visited logic

Fixes #13