Update find sets function