remove unneccesary visited flag