Finished check_visited.m