added visited functionality