finished the remove duplicate individuals function