added case when list already contains vertex