Updated visited logic

Fixes #15